diff options
-rw-r--r-- | sworker.js | 25 |
1 files changed, 14 insertions, 11 deletions
@@ -1,4 +1,4 @@ -var version = 'v35 2016-01-06'; +var version = 'v36 2016-01-19'; var toCache = [ '/', 'activePage.js', @@ -19,22 +19,25 @@ var toCache = [ ]; self.addEventListener('install', event => { - event.waitUntil( - caches.open('static' + version).then(c => c.addAll(toCache)) - ); + event.waitUntil( + caches.open('static' + version) + .then( + c => c.addAll(toCache) + .then(v => console.log('********* Yay!'), e => console.log('************* Error')) + ) + ); }); self.addEventListener('activate', event => { - console.log('caches.keys() = ' + caches.keys()); - event.waitUntil( - Promise.all( - caches.keys().then(keys => - keys.filter(key => key != 'static' + version).map(key => caches.delete(key)) - ) + event.waitUntil(caches.keys().then( + keys => Promise.all( + keys.filter(key => key != 'static' + version). + map(key => caches.delete(key)) + ) ) ); }); -self.addEventListener('fetch', event => { +self.addEventListener('fetch', function(event) { event.respondWith(caches.match(event.request)); }); |