1// SERVE ALL THE THINGS!!! 2/* global self */ 3self.addEventListener("fetch", event => { 4 if (event.request.method === "GET") { 5 event.respondWith( 6 /* global caches */ 7 caches 8 .match(event.request) 9 .then(response => { 10 if (response) { 11 console.log("SERVICE WORKER::CACHE " + response.url); 12 return response; 13 } else { 14 // console.log( 'SERVICE WORKER::LIVE ' + event.request.url ) 15 return fetch(event.request); 16 } 17 }) 18 .catch(error => { 19 if (event.request.method === "GET") { 20 console.warn( 21 "SERVICE WORKER::FAILED fetch(" + 22 event.request.url + 23 ") failed", 24 error 25 ); 26 return caches.match("offline.html"); 27 } else { 28 console.warn( 29 "SERVICE WORKER::FAILED " + event.request.method, 30 error 31 ); 32 } 33 }) 34 ); 35 } 36});
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.