Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function subscribeUser() {
- const applicationServerKey =
- urlB64ToUint8Array(applicationServerPublicKey);
- swRegistration.pushManager.subscribe({
- userVisibleOnly: true,
- applicationServerKey: applicationServerKey
- })
- .then(function(subscription) {
- console.log('User is subscribed.');
- updateSubscriptionOnServer(subscription);
- isSubscribed = true;
- updateBtn();
- })
- .catch(function(err) {
- console.log('Failed to subscribe the user: ', err);
- updateBtn();
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement