1/* eslint-disable no-restricted-globals, no-undef */ 2function receivePushNotification(event) { 3 console.log('[Service Worker] Push Received.'); 4 const { image, url, title, text } = event.data.json(); 5 6 const options = { 7 data: url, 8 body: text, 9 icon: image, 10 vibrate: [200, 100, 200], 11 }; 12 event.waitUntil(self.registration.showNotification(title, options)); 13} 14 15function openPushNotification(event) { 16 console.log( 17 '[Service Worker] Notification click Received.', 18 event.notification.data, 19 ); 20 event.notification.close(); 21 event.waitUntil(clients.openWindow(event.notification.data)); 22} 23 24self.addEventListener('install', (e) => { 25 console.log('[Service Worker] Install.'); 26 self.skipWaiting(); 27}); 28 29self.addEventListener('push', receivePushNotification); 30self.addEventListener('notificationclick', openPushNotification);
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.