1// Amiku service worker â PWA install + push notifications. 2// No caching: all requests go straight to network. 3 4self.addEventListener('push', (event) => { 5 const data = event.data ? event.data.json() : {}; 6 const title = data.title || 'Amiku'; 7 const options = { 8 body: data.body || 'You have a new message', 9 icon: '/assets/brand/icon-180.png', 10 badge: '/assets/brand/icon-180.png', 11 data: { url: data.url || '/my/' }, 12 }; 13 event.waitUntil(self.registration.showNotification(title, options)); 14}); 15 16self.addEventListener('notificationclick', (event) => { 17 event.notification.close(); 18 const url = event.notification.data?.url || '/my/'; 19 event.waitUntil( 20 clients.matchAll({ type: 'window', includeUncontrolled: true }).then((windowClients) => { 21 // Focus existing tab if open 22 for (const client of windowClients) { 23 if (client.url.includes('/my/') && 'focus' in client) { 24 return client.focus().then((c) => c.navigate(url)); 25 } 26 } 27 // Otherwise open new window 28 return clients.openWindow(url); 29 }) 30 ); 31}); 32 33self.addEventListener('fetch', () => { 34 // Network-only: do nothing, let the browser handle it normally 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.