-
Notifications
You must be signed in to change notification settings - Fork 1
/
sw.js
26 lines (24 loc) · 893 Bytes
/
sw.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const cacheName = 'lifx-cache';
const cacheVersion = '1.1.0'; // Needed for service worker auto update
self.addEventListener('install', (event) => {
event.waitUntil(
caches.delete(cacheName).then((deleted) => {
caches.open(cacheName).then((cache) => cache.addAll([
'/lifx/',
'/lifx/package.json',
'/lifx/manifest.json',
'/lifx/assets/images/icon.png',
'/lifx/assets/images/icon-192x192.png',
'/lifx/assets/css/bootstrap.min.css',
'/lifx/assets/css/bootstrap-icons.min.css',
'/lifx/assets/css/fonts/bootstrap-icons.woff2',
'/lifx/assets/css/style.min.css',
'/lifx/assets/js/bootstrap.bundle.min.js',
'/lifx/assets/js/script.min.js',
]));
})
);
});
self.addEventListener('fetch', (event) => {
event.respondWith(caches.open(cacheName).then((cache) => cache.match(event.request).then((response) => response || fetch(event.request))));
});