1importScripts('https://www.gstatic.com/firebasejs/3.9.0/firebase-app.js'); 2importScripts('https://www.gstatic.com/firebasejs/3.9.0/firebase-messaging.js'); 3 4// Initialize the Firebase app in the service worker by passing in the 5// messagingSenderId. 6firebase.initializeApp({ 7 'messagingSenderId': '620431458743' 8}); 9 10// Retrieve an instance of Firebase Messaging so that it can handle background 11// messages. 12const messaging = firebase.messaging(); 13 14messaging.setBackgroundMessageHandler(function(payload) { 15 var notification = JSON.parse(payload.data.notification); 16 17 // Customize notification here 18 const notificationTitle = notification.title; 19 const notificationOptions = { 20 body: notification.body, 21 icon:notification.icon, 22 click_action: notification.click_action 23 }; 24 25 self.addEventListener('notificationclick', function(event) { 26 event.notification.close(); 27 event.waitUntil(self.clients.openWindow(notification.click_action)); 28 }); 29 30 return self.registration.showNotification(notificationTitle, 31 notificationOptions); 32});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.