Created
December 4, 2018 15:59
-
-
Save AyoAlfonso/ac9d6c04e097c43c95fb3bb58f42c5f4 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/4.8.1/firebase-app.js'); | |
importScripts('https://www.gstatic.com/firebasejs/4.8.1/firebase-messaging.js'); | |
import messaging from 'config/firebase' | |
messaging.setBackgroundMessageHandler(function (payload) { | |
console.log('We Received a background message ', payload); | |
const notificationTitle = 'New Background Message Title'; | |
const notificationOptions = { | |
body: 'Fallback Message body.', | |
icon: 'logo.png' | |
}; | |
return self.registration.showNotification(notificationTitle, | |
notificationOptions); | |
}); | |
self.addEventListener("notificationclick", function (event) { | |
const clickedNotification = event.notification; | |
clickedNotification.close(); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment