Add service worker to V1

This commit is contained in:
Nicholas Jitkoff 2022-05-21 12:13:56 -07:00
parent 5cc8271f47
commit d2f06549d1
3 changed files with 23 additions and 2 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,2 +1,2 @@
CACHE MANIFEST
# itty bitty manifest 22.05.21
# itty bitty manifest 22.05.21

20
docs/v1/worker.js Normal file
View file

@ -0,0 +1,20 @@
self.addEventListener('install', function(e) {
e.waitUntil(
caches.open('ittybitty-v1').then(function(cache) {
return cache.addAll([
'/',
'/favicon.ico'
]);
})
);
});
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request).then(function(response) {
console.debug("Requested", event.request.url, response);
return response || fetch(event.request);
})
);
});