20 lines
482 B
JavaScript
20 lines
482 B
JavaScript
const CACHE_NAME = 'datumsrechner-cache-v1';
|
|
const urlsToCache = [
|
|
'/',
|
|
'/static/style.css',
|
|
'/static/favicon.ico',
|
|
'/static/favicon.png',
|
|
'/static/logo.svg',
|
|
];
|
|
self.addEventListener('install', event => {
|
|
event.waitUntil(
|
|
caches.open(CACHE_NAME)
|
|
.then(cache => cache.addAll(urlsToCache))
|
|
);
|
|
});
|
|
self.addEventListener('fetch', event => {
|
|
event.respondWith(
|
|
caches.match(event.request)
|
|
.then(response => response || fetch(event.request))
|
|
);
|
|
});
|