diff --git a/firebase-messaging-sw.js b/firebase-messaging-sw.js index fc5dc1c..8a5dc03 100644 --- a/firebase-messaging-sw.js +++ b/firebase-messaging-sw.js @@ -1,22 +1,22 @@ // Give the service worker access to Firebase Messaging. -importScripts('https://www.gstatic.com/firebasejs/4.9.1/firebase-app.js') -importScripts('https://www.gstatic.com/firebasejs/4.9.1/firebase-messaging.js') +importScripts('https://www.gstatic.com/firebasejs/4.9.1/firebase-app.js'); +importScripts('https://www.gstatic.com/firebasejs/4.9.1/firebase-messaging.js'); // Initialize the Firebase app in the service worker by passing in the messagingSenderId. var config = { - messagingSenderId: "your_messaging_sender_id" + messagingSenderId: 'your_messaging_sender_id', }; firebase.initializeApp(config); // Retrieve an instance of Firebase Data Messaging so that it can handle background messages. -const messaging = firebase.messaging() -messaging.setBackgroundMessageHandler(function(payload) { +const messaging = firebase.messaging(); +messaging.setBackgroundMessageHandler((payload) => { const notificationTitle = 'Data Message Title'; const notificationOptions = { body: 'Data Message body', - icon: 'alarm.png' + icon: 'alarm.png', }; return self.registration.showNotification(notificationTitle, - notificationOptions); + notificationOptions); }); diff --git a/index.html b/index.html index 8f8e20c..7f69357 100644 --- a/index.html +++ b/index.html @@ -1,23 +1,20 @@
- - - - - - -