I want to pass a value from the function to outside in Typescript.
I have tried many method, e.g. thing to declare global variables, return function value, etc, but it doesn’t work.
I think maybe my syntax is wrong. Could you please have a help? Code as below for reference. Many thanks.
this.platform.ready().then(() => {
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
}