Created
February 9, 2018 13:39
-
-
Save arikanmstf/02364b8b48fed13aeaeda4d8b4f7e419 to your computer and use it in GitHub Desktop.
Service Worker Example
This file contains hidden or 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
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