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 if (!(self.Notification && self.Notification.permission === 'granted')) { 19 //notifications aren't supported or permission not granted! 20 return; 21 } 22 23 if (e.data) { 24 var msg = e.data.json(); 25 console.log(msg) 26 e.waitUntil(self.registration.showNotification(msg.title, { 27 body: msg.body, 28 icon: msg.icon, 29 actions: msg.actions, 30 data: msg.data.url 31 })); 32 } 33}); 34
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.