1const CACHE_NAME = "bethive-cache"; 2const urlsToCache = ["/", "/index.html", "/manifest.json", "/logo512.png"]; 3 4window.self.addEventListener("install", (event) => { 5 event.waitUntil( 6 caches.open(CACHE_NAME).then((cache) => { 7 return cache.addAll(urlsToCache).then(() => window.self.skipWaiting()); 8 }) 9 ); 10}); 11 12window.self.addEventListener("activate", (event) => { 13 event.waitUntil(window.self.clients.claim()); 14}); 15 16window.self.addEventListener("fetch", (event) => { 17 if (navigator.onLine) { 18 var fetchRequest = event.request.clone(); 19 return fetch(fetchRequest).then(function (response) { 20 if (!response || response.status !== 200 || response.type !== "basic") { 21 return response; 22 } 23 var responseToCache = response.clone(); 24 caches.open(CACHE_NAME).then((cache) => { 25 cache.put(event.request, responseToCache); 26 }); 27 return response; 28 }); 29 } else { 30 event.respondWith( 31 caches.match(event.request).then((response) => { 32 if (response) { 33 return response; 34 } 35 }) 36 ); 37 } 38});
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.