diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2016-01-19 22:47:43 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2016-01-19 22:47:43 +0100 |
commit | 069fde886eeb9c06728eba18f765d987b5174c10 (patch) | |
tree | 773ab1269ba3877ca81694cd1675659c51062fcf | |
parent | 2334b9a2760e037889a5fcdb9aac91affa335e0a (diff) | |
download | zalmy-069fde886eeb9c06728eba18f765d987b5174c10.tar.gz |
An attempt to fix ServiceWorkers, but it is broken. Somewhere.
-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)); }); |