in fcm-notifications/public/main.js [185:200]
Demo.prototype.saveToken = function() {
firebase.messaging().getToken().then(function(currentToken) {
if (currentToken) {
firebase.database().ref('users/' + this.currentUid + '/notificationTokens/' + currentToken).set(true);
} else {
this.requestPermission();
}
}.bind(this)).catch(function(err) {
console.error('Unable to get messaging token.', err);
if (err.code === 'messaging/permission-default') {
this.fcmErrorContainer.innerText = 'You have not enabled notifications on this browser. To enable notifications reload the page and allow notifications using the permission dialog.';
} else if (err.code === 'messaging/notifications-blocked') {
this.fcmErrorContainer.innerHTML = 'You have blocked notifications on this browser. To enable notifications follow these instructions: <a href="https://support.google.com/chrome/answer/114662?visit_id=1-636150657126357237-2267048771&rd=1&co=GENIE.Platform%3DAndroid&oco=1">Android Chrome Instructions</a><a href="https://support.google.com/chrome/answer/6148059">Desktop Chrome Instructions</a>';
}
}.bind(this));
};