Skip to content

Instantly share code, notes, and snippets.

@bt4R9
Created November 25, 2016 12:10
Show Gist options
  • Save bt4R9/9ed6d0b88740ca06e124c91ef0653510 to your computer and use it in GitHub Desktop.
Save bt4R9/9ed6d0b88740ca06e124c91ef0653510 to your computer and use it in GitHub Desktop.
'use strict';
self.addEventListener('install', function(event) {
event.waitUntil(self.skipWaiting());
});
self.addEventListener('push', function(event) {
debugger;
var payload = event.data ? event.data.text() : 'no payload';
event.waitUntil(
self.registration.showNotification('omg its alive!', {
body: payload,
})
);
});
self.addEventListener('notificationclick', function(event) {
debugger;
event.notification.close();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment