mirror of
https://github.com/arfct/itty-bitty.git
synced 2026-03-11 08:54:33 +00:00
Add service worker to V1
This commit is contained in:
parent
5cc8271f47
commit
d2f06549d1
3 changed files with 23 additions and 2 deletions
File diff suppressed because one or more lines are too long
|
|
@ -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
20
docs/v1/worker.js
Normal 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);
|
||||
})
|
||||
);
|
||||
});
|
||||
Loading…
Reference in a new issue