I referred to this documentation on the ionic site, to integrate firebase with my mobile application.
this.firebase.getToken()
.then(token => console.log(`The token is ${token}`)) // save the token server-side and use it to push notifications to this device
.catch(error => console.error('Error getting token', error));
this.firebase.onTokenRefresh()
.subscribe((token: string) => console.log(`Got a new token ${token}`));
As seen in the above code, the 'then'
, 'catch'
and 'subscribe'
methods seem to have a variable followed by the "=>"
symbol. Does this symbol have a generic meaning or does it vary from method to method? What exactly does it mean?
EDIT: Since this question is marked duplicate by others, I thought it was a new feature in typescript that I was not aware of. In JavaScript, I had always used the old school method as pointed in one of the answers. It might help others like me, however.