-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsw.ts
47 lines (47 loc) · 1.26 KB
/
sw.ts
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// const CACHE_NAME = 'cache-v2';
// const DYNAMIC_CACHE_NAME = 'dynamic';
//
// // List of URLs to precache
// const PRECACHE_URLS: string[] = [
// '/',
// '/catalog',
// '/files',
// ];
//
// self.addEventListener('install', (event: any) => {
// event.waitUntil(
// caches.open(CACHE_NAME).then((cache) => {
// return cache.addAll(PRECACHE_URLS);
// })
// );
// });
//
// self.addEventListener('fetch', (event: any) => {
// event.respondWith(
// caches.match(event.request).then((cachedResponse) => {
// if (cachedResponse) {
// return cachedResponse;
// }
// return fetch(event.request).then((networkResponse) => {
// return caches.open(DYNAMIC_CACHE_NAME).then((cache) => {
// cache.put(event.request, networkResponse.clone());
// return networkResponse;
// });
// });
// })
// );
// });
//
// self.addEventListener('activate', (event: any) => {
// event.waitUntil(
// caches.keys().then((cacheNames) => {
// return Promise.all(
// cacheNames.map((cacheName) => {
// if (cacheName !== CACHE_NAME && cacheName !== DYNAMIC_CACHE_NAME) {
// return caches.delete(cacheName);
// }
// })
// );
// })
// );
// });