blob: 84d94df3e7e4fd221d97408d0fea44ac894a0c22 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
const CACHE_NAME = 'cafe';
const urlsToCache = [
'/',
'/static/css/style.css',
'/static/js/htmx.min.js',
'/static/js/app.js',
'/static/manifest.json'
];
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))
);
});
|