PageSourceSearch

https://qikio.com.au/sw.js

js qikio.com.au collected 2026-10-09 22:11:17 UTC 1,531 bytes, 52 lines download raw bytes

1const CACHE_NAME = 'qikio-v1';
2const STATIC_ASSETS = [
3  '/',
4  '/manifest.json',
5  '/qikio_logo.png',
6];
7
8self.addEventListener('install', (event) => {
9  event.waitUntil(
10    caches.open(CACHE_NAME).then((cache) => cache.addAll(STATIC_ASSETS))
11  );
12  self.skipWaiting();
13});
14
15self.addEventListener('activate', (event) => {
16  event.waitUntil(
17    caches.keys().then((keys) =>
18      Promise.all(keys.filter((k) => k !== CACHE_NAME).map((k) => caches.delete(k)))
19    )
20  );
21  self.clients.claim();
22});
23
24self.addEventListener('fetch', (event) => {
25  if (event.request.method !== 'GET') return;
26
27  // Network-first for API calls and HTML — fall back to cache, then to a useful response
28  if (event.request.url.includes('/api/') || event.request.mode === 'navigate') {
29    event.respondWith(
30      fetch(event.request).catch(() =>
31        caches.match(event.request).then((cached) =>
32          cached || (event.request.mode === 'navigate' ? caches.match('/') : Response.error())
33        )
34      )
35    );
36    return;
37  }
38
39  // Cache-first for static assets — catch network failures so we never throw past respondWith
40  event.respondWith(
41    caches.match(event.request).then((cached) => {
42      if (cached) return cached;
43      return fetch(event.request).then((response) => {
44        if (response && response.ok) {
45          const clone = response.clone();
46          caches.open(CACHE_NAME).then((cache) => cache.put(event.request, clone));
47        }
48        return response;
49      }).catch(() => Response.error());
50    })
51  );
52});

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.