title: Pass variable from function in Typescript
body: <p>I want to pass a value from the function to outside in Typescript.</p>
  
  <p>I have tried many method, e.g. thing to declare global variables, return function value, etc, but it doesn’t work. </p>
  
  <p>I think maybe my syntax is wrong. Could you please have a help? Code as below for reference.
  Many thanks.</p>
  
  <pre><code>    this.platform.ready().then(() =&gt; {
  
          FCMPlugin.getToken(
                      function (token) {
                          console.log(token);
                      },
                      function (err) {
                          console.log('error retrieving token: ' + err);
                      }
          );
  
          console.log(token); //I would to pass the token value to here
      }
  </code></pre>