Last active
March 18, 2019 18:36
-
-
Save Serginho/fce2b5d92459ae02ee90f08f9c98202c to your computer and use it in GitHub Desktop.
push subscriptionchange upload token null
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async handlePush(event: PushSubscriptionChangeEvent) { | |
const req = new Request('/refreshpushsubscription', { | |
method: 'POST', | |
body: JSON.stringify( | |
{oldSubscription: event.oldSubscription, newSubscription: event.newSubscription}) | |
}); | |
const response = await self.fetch(req); | |
} | |
self.addEventListener('pushsubscriptionchange', (event: PushSubscriptionChangeEvent) => | |
event.waitUntil(handlePush(event))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment