24 lines
467 B
JavaScript
24 lines
467 B
JavaScript
const CACHE_NAME = 'uptime-v1';
|
|
const ASSETS = [
|
|
'/',
|
|
'/index.php',
|
|
'/assets/css/custom.css',
|
|
'/manifest.json'
|
|
];
|
|
|
|
self.addEventListener('install', (event) => {
|
|
event.waitUntil(
|
|
caches.open(CACHE_NAME).then((cache) => {
|
|
return cache.addAll(ASSETS);
|
|
})
|
|
);
|
|
});
|
|
|
|
self.addEventListener('fetch', (event) => {
|
|
event.respondWith(
|
|
caches.match(event.request).then((response) => {
|
|
return response || fetch(event.request);
|
|
})
|
|
);
|
|
});
|