1// Service Worker for push notifications 2self.addEventListener("push", (event) => { 3 if (!event.data) return; 4 5 try { 6 const data = event.data.json(); 7 const options = { 8 body: data.body || "", 9 icon: "/favicon.ico", 10 badge: "/favicon.ico", 11 data: { tripId: data.tripId, type: data.type }, 12 vibrate: [200, 100, 200], 13 }; 14 15 event.waitUntil(self.registration.showNotification(data.title || "Cargo Link", options)); 16 } catch (e) { 17 console.error("Push event error:", e); 18 } 19}); 20 21self.addEventListener("notificationclick", (event) => { 22 event.notification.close(); 23 event.waitUntil( 24 clients.matchAll({ type: "window", includeUncontrolled: true }).then((clientList) => { 25 if (clientList.length > 0) { 26 return clientList[0].focus(); 27 } 28 return clients.openWindow("/"); 29 }) 30 ); 31});
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.