1var CACHE_NAME = 'coin-dance-cache-v1'; 2var urlsToCache = [ 3 '/' 4]; 5 6// Set the callback for the install step 7self.addEventListener('install', function(event) { 8 // Perform install steps 9 event.waitUntil( 10 caches.open(CACHE_NAME) 11 .then(function(cache) { 12 console.log('Opened cache'); 13 return cache.addAll(urlsToCache); 14 }) 15 ); 16}); 17 18self.addEventListener('fetch', function(event) { 19 event.respondWith( 20 caches.match(event.request) 21 .then(function(response) { 22 // Cache hit - return response 23 if (response) { 24 return response; 25 } 26 27 return fetch(event.request); 28 } 29 ) 30 ); 31}); 32 33self.addEventListener('activate', function(event) { 34 35 var cacheWhitelist = []; 36 37 event.waitUntil( 38 caches.keys().then(function(cacheNames) { 39 return Promise.all( 40 cacheNames.map(function(cacheName) { 41 if (cacheWhitelist.indexOf(cacheName) === -1) { 42 return caches.delete(cacheName); 43 } 44 }) 45 ); 46 }) 47 ); 48});
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.