mirror of
https://github.com/arfct/itty-bitty.git
synced 2026-03-11 08:54:33 +00:00
20 lines
No EOL
455 B
JavaScript
20 lines
No EOL
455 B
JavaScript
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);
|
|
})
|
|
);
|
|
}); |