Created
November 25, 2016 12:10
-
-
Save bt4R9/9ed6d0b88740ca06e124c91ef0653510 to your computer and use it in GitHub Desktop.
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
'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