1const CACHE_NAME = 'sw-v1'; 2self.addEventListener('install', function(event) { 3 event.waitUntil( 4 caches.open(CACHE_NAME) 5 // .then(function(cache) {cache.addAll('./homepage.html')}) 6 ) 7}) 8self.addEventListener('fetch', function (event) { 9 if (event.request.method === 'GET') { 10 event.respondWith( 11 caches.match(event.request) 12 .then(function(cached) { 13 var networked = fetch(event.request) 14 .then(function(response) { 15 var cacheCopy = response.clone() 16 // caches.open(CACHE_NAME) 17 // .then(cache => cache.put(event.request, cacheCopy)) 18 return response; 19 }) 20 .catch(function() {caches.match(offlinePage)}); 21 return cached || networked; 22 }) 23 ) 24 } 25 return; 26})
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.