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
} else if (url.pathname.startsWith('/')) {
// : TODO : if is /web
const asyncResponse = fetchRoot();
const asyncCache = openWebCache();
// const asyncResponse = fetchRoot();
// const asyncCache = openWebCache();
event.respondWith(asyncResponse.then(
response => {
const clonedResponse = response.clone();
asyncCache.then(cache => cache.put('/', clonedResponse)).catch();
return response;
},
() => asyncCache.then(cache => cache.match('/'))));
// event.respondWith(asyncResponse.then(
// response => {
// const clonedResponse = response.clone();
// asyncCache.then(cache => cache.put('/', clonedResponse)).catch();
// return response;
// },
// () => asyncCache.then(cache => cache.match('/'))));
} /* else if (storageFreeable && (ATTACHMENT_HOST ? url.host === ATTACHMENT_HOST : url.pathname.startsWith('/system/'))) {
event.respondWith(openSystemCache().then(cache => {
return cache.match(event.request.url).then(cached => {