1// Crew web-push service worker (P4). Pushes are sent no-payload (VAPID auth only), 2// so we show a generic nudge; the real content lives in the in-app bell. 3self.addEventListener('push', (event) => { 4 let data = { title: 'Crew', body: 'Open Crew to check in.', url: '/app' }; 5 try { if (event.data) data = { ...data, ...event.data.json() }; } catch (_) { /* no payload */ } 6 event.waitUntil( 7 self.registration.showNotification(data.title || 'Crew', { 8 body: data.body || 'Open Crew.', 9 icon: '/favicon.svg', 10 badge: '/favicon.svg', 11 data: { url: data.url || '/app' }, 12 }), 13 ); 14}); 15 16self.addEventListener('notificationclick', (event) => { 17 event.notification.close(); 18 const url = (event.notification.data && event.notification.data.url) || '/app'; 19 event.waitUntil( 20 self.clients.matchAll({ type: 'window', includeUncontrolled: true }).then((cs) => { 21 for (const c of cs) { if ('focus' in c) return c.focus(); } 22 return self.clients.openWindow(url); 23 }), 24 ); 25});
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.