Created
August 26, 2019 15:39
-
-
Save Spyna/a92f163c9ff10ce9f416262cb29524bf to your computer and use it in GitHub Desktop.
How to open a web push notification
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
function openPushNotification(event) { | |
console.log("[Service Worker] Notification click Received.", event.notification.data); | |
event.notification.close(); | |
event.waitUntil(clients.openWindow(event.notification.data)); | |
} | |
self.addEventListener("notificationclick", openPushNotification); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment