PageSourceSearch

https://www.turnoffthelights.com/sw.js

js turnoffthelights.com collected 2026-09-24 08:29:54 UTC 1,302 bytes, 47 lines download raw bytes

1// This is the "Offline page" service worker
2
3importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js');
4
5const CACHE = "pwabuilder-page";
6
7// Replace the following with the correct offline fallback page i.e.: const offlineFallbackPage = "offline.html";
8const offlineFallbackPage = "offline.html";
9
10self.addEventListener("message", (event) => {
11  if (event.data && event.data.type === "SKIP_WAITING") {
12    self.skipWaiting();
13  }
14});
15
16self.addEventListener('install', async (event) => {
17  event.waitUntil(
18    caches.open(CACHE)
19      .then((cache) => cache.add(offlineFallbackPage))
20  );
21});
22
23if (workbox.navigationPreload.isSupported()) {
24  workbox.navigationPreload.enable();
25}
26
27self.addEventListener('fetch', (event) => {
28  if (event.request.mode === 'navigate') {
29    event.respondWith((async () => {
30      try {
31        const preloadResp = await event.preloadResponse;
32
33        if (preloadResp) {
34          return preloadResp;
35        }
36
37        const networkResp = await fetch(event.request);
38        return networkResp;
39      } catch (error) {
40
41        const cache = await caches.open(CACHE);
42        const cachedResp = await cache.match(offlineFallbackPage);
43        return cachedResp;
44      }
45    })());
46  }
47});

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.