1/* eslint-disable no-restricted-globals */ 2self.addEventListener("push", (event) => { 3 let data = { title: "Shraddha Saburi Path", body: "Time for your sadhana!", url: "/dashboard" }; 4 try { data = event.data.json(); } catch {} 5 event.waitUntil( 6 self.registration.showNotification(data.title, { 7 body: data.body, 8 icon: "/logo192.png", 9 badge: "/logo192.png", 10 data: { url: data.url }, 11 vibrate: [100, 50, 100], 12 }) 13 ); 14}); 15 16self.addEventListener("notificationclick", (event) => { 17 event.notification.close(); 18 const url = event.notification.data?.url || "/dashboard"; 19 event.waitUntil( 20 self.clients.matchAll({ type: "window" }).then((clients) => { 21 for (const client of clients) { 22 if (client.url.includes(self.location.origin) && "focus" in client) return client.focus(); 23 } 24 return self.clients.openWindow(url); 25 }) 26 ); 27});
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.