PageSourceSearch

https://hauskaaonnellista.fi/sw.js

js hauskaaonnellista.fi collected 2026-10-07 15:22:44 UTC 1,182 bytes, 34 lines download raw bytes

1// Minimal service worker for PWA installability — no aggressive caching.
2self.addEventListener('install', (event) => {
3  self.skipWaiting()
4})
5
6self.addEventListener('activate', (event) => {
7  event.waitUntil(self.clients.claim())
8})
9
10self.addEventListener('fetch', (event) => {
11  const { request } = event
12
13  // Only page navigations go through the worker. Subresources are left to
14  // the browser: Chrome won't reuse a <link rel="preload"> response that was
15  // supplied via respondWith() ("cross-world service worker resource
16  // mismatch") and requests the file again.
17  if (request.mode !== 'navigate') {
18    return
19  }
20
21  // Chrome sometimes issues speculative/prefetch requests with
22  // cache: 'only-if-cached' and a non-same-origin mode. Passing those
23  // straight to fetch() throws synchronously - just let the browser
24  // handle them instead of intercepting.
25  if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') {
26    return
27  }
28
29  // This service worker does no caching of its own - just pass requests
30  // through, but never leave a rejected fetch() unhandled.
31  event.respondWith(
32    fetch(request).catch(() => Response.error())
33  )
34})

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.