1self.addEventListener('install', function(event) { 2 self.skipWaiting(); 3}); 4self.addEventListener('activate', function(event) { 5}); 6self.addEventListener('push', function(event) { 7 8 event.waitUntil( 9 fetch("https://api.pushinstruments.com/global/check/?key=0WUpGIMbdp6KTSblR3QCmZwQhQjXYXvT").then(function(response) { 10 if (response.status !== 200) { 11 throw new Error(); 12 } 13 14 // Examine the text in the response 15 return response.json().then(function(data) { 16 if (data.error || !data.notification) { 17 throw new Error(); 18 } 19 20 var title = data.notification.title; 21 var message = data.notification.message; 22 var icon = data.notification.icon; 23 var image = data.notification.image; 24 var notificationTag = data.notification.tag; 25 var final_link = data.notification.link; 26 27 return self.registration.showNotification(title, { 28 body: message, 29 icon: icon, 30 image: image, 31 tag: notificationTag, 32 data: data, 33 requireInteraction: true 34 }); 35 }); 36 }).catch(function(err) { 37 console.error('Unable to retrieve data', err); 38 }) 39 ); 40}); 41 42self.addEventListener('notificationclick', function(event) { 43 event.waitUntil( 44 clients.matchAll({ 45 type: "window" 46 }) 47 .then(function(clientList) { 48 return clients.openWindow(event.notification.data.notification.link); 49 }) 50 ); 51 event.notification.close(); 52});
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.