debug service worker

This commit is contained in:
mgabdev 2020-04-03 19:18:21 -04:00
parent 0a89c7b775
commit c6fdcb91c8

View File

@ -69,16 +69,16 @@ self.addEventListener('fetch', function (event) {
//non-webapp routes //non-webapp routes
} else if (url.pathname.startsWith('/')) { } else if (url.pathname.startsWith('/')) {
// : TODO : if is /web // : TODO : if is /web
const asyncResponse = fetchRoot(); // const asyncResponse = fetchRoot();
const asyncCache = openWebCache(); // const asyncCache = openWebCache();
event.respondWith(asyncResponse.then( // event.respondWith(asyncResponse.then(
response => { // response => {
const clonedResponse = response.clone(); // const clonedResponse = response.clone();
asyncCache.then(cache => cache.put('/', clonedResponse)).catch(); // asyncCache.then(cache => cache.put('/', clonedResponse)).catch();
return response; // return response;
}, // },
() => asyncCache.then(cache => cache.match('/')))); // () => asyncCache.then(cache => cache.match('/'))));
} /* else if (storageFreeable && (ATTACHMENT_HOST ? url.host === ATTACHMENT_HOST : url.pathname.startsWith('/system/'))) { } /* else if (storageFreeable && (ATTACHMENT_HOST ? url.host === ATTACHMENT_HOST : url.pathname.startsWith('/system/'))) {
event.respondWith(openSystemCache().then(cache => { event.respondWith(openSystemCache().then(cache => {
return cache.match(event.request.url).then(cached => { return cache.match(event.request.url).then(cached => {