Skip to content

Instantly share code, notes, and snippets.

@arikanmstf
Created February 9, 2018 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save arikanmstf/02364b8b48fed13aeaeda4d8b4f7e419 to your computer and use it in GitHub Desktop.
Save arikanmstf/02364b8b48fed13aeaeda4d8b4f7e419 to your computer and use it in GitHub Desktop.
Service Worker Example
self.addEventListener('push', function (event) {
if (event && event.data) {
const data = event.data.json();
event.waitUntil(self.registration.showNotification(data.title, {
body: data.body,
icon: data.icon || null
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment