1// // @ts-check 2 3// /// <reference no-default-lib="true" /> 4// /// <reference lib="esnext" /> 5// /// <reference lib="webworker" /> 6 7// const sw = /** @type { ServiceWorkerGlobalScope & typeof globalThis } */ ( 8// globalThis 9// ) 10 11const sw = globalThis; 12 13sw.addEventListener("push", (event) => { 14 const message = event?.data?.json(); 15 const { title, body } = message 16 17 async function handlePushEvent() { 18 // const windowCLient = await sw.clients.matchAll() 19 20 await sw.registration.showNotification(title, { 21 body, 22 icon: '/images/logo.png', 23 image: '/images/logo.png', 24 badge: '/images/logo.png', 25 // renotify: true 26 }) 27 28 } 29 30 event.waitUntil(handlePushEvent()) 31}) 32 33sw.addEventListener('install', () => { 34 sw.skipWaiting(); 35}); 36 37sw.addEventListener('activate', event => { 38 event.waitUntil(sw.clients.claim()); 39});
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.