1 2self.addEventListener('notificationclick', function(event) { 3 // Android doesn't close the notification when you click on it 4 // See: http://crbug.com/463146 5 event.notification.close(); 6 // This looks to see if the current is already open and 7 // focuses if it is 8if (event.action === 'view_notification') { 9 // Do something... 10 self.clients.openWindow(event.notification.data) 11} else { 12 self.clients.openWindow(event.notification.data) 13} 14}); 15 16 17self.addEventListener('push', function (e) { 18 console.log("push called") 19 if (!(self.Notification && self.Notification.permission === 'granted')) { 20 //notifications aren't supported or permission not granted! 21 return; 22 } 23 24 if (e.data) { 25 var msg = e.data.json(); 26 console.log(msg) 27 e.waitUntil(self.registration.showNotification(msg.title, { 28 body: msg.body, 29 icon: msg.icon, 30 actions: msg.actions, 31 data: msg.data.url 32 })); 33 } 34}); 35
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.