Skip to content

Instantly share code, notes, and snippets.

@beverloo
Created July 13, 2016 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beverloo/bba38571dafee9c37a2cf867fe5fb562 to your computer and use it in GitHub Desktop.
Save beverloo/bba38571dafee9c37a2cf867fe5fb562 to your computer and use it in GitHub Desktop.
self.addEventListener('push', async(e) => {
const notification = await fetch(e.data.text()); // payload contains a URL
await registration.showNotification(notification.title, {
body: notification.body,
icon: notification.icon
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment