Last active
March 24, 2019 02:27
-
-
Save jotapeluiz/3917665ca3d8d29e89f428c40a9c71be to your computer and use it in GitHub Desktop.
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
| importScripts("https://www.gstatic.com/firebasejs/5.7.1/firebase-app.js"); | |
| importScripts("https://www.gstatic.com/firebasejs/5.7.1/firebase-messaging.js"); | |
| const config = { | |
| messagingSenderId: "<MESSAGING_SENDER_ID>" | |
| } | |
| firebase.initializeApp(config); | |
| const messaging = firebase.messaging(); | |
| messaging.setBackgroundMessageHandler(function(payload) { | |
| const notification = JSON.parse(payload.data.notification); | |
| return self.registration.showNotification(notification.title, notification); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment