1self.addEventListener('activate', function(event) { 2 var expectedCacheNames = Object.keys(CURRENT_CACHES).map(function(key) { 3 return CURRENT_CACHES[key]; 4 }); 5 6 event.waitUntil( 7 caches.keys().then(function(cacheNames) { 8 return Promise.all( 9 cacheNames.map(function(cacheName) { 10 if (expectedCacheNames.indexOf(cacheName) === -1) { 11 return caches.delete(cacheName); 12 } 13 }) 14 ); 15 }) 16 ); 17}); 18 19self.addEventListener('fetch', function(event) { 20 event.respondWith( 21 caches.open(CURRENT_CACHES.font).then(function(cache) { 22 return cache.match(event.request).then(function(response) { 23 if (response) { 24 return response; 25 } 26 27 return fetch(event.request.clone()).then(function(response) { 28 if (response.status < 400) { 29 cache.put(event.request, response.clone()); 30 } 31 32 return response; 33 }); 34 }); 35 }) 36 ); 37}); 38 39self.addEventListener('message', function(event) { 40 if (event.data.action === 'skipWaiting') { 41 self.skipWaiting(); 42 } 43});
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.