diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-01-14 12:20:20 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-01-14 12:20:20 +0800 |
| commit | e4adb5dbc6952c4ddbb031e4999f4181f2de8b03 (patch) | |
| tree | 8aade721eb33966baed6f1d45edee24e865973db /public/sw.js | |
| parent | 1bb4b2d77a1f402ad61cf0058e94d2bf1a7e1703 (diff) | |
un-comment codes
Diffstat (limited to 'public/sw.js')
| -rw-r--r-- | public/sw.js | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/public/sw.js b/public/sw.js index e6a263d1..61bac97c 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1,27 +1,27 @@ -// const cacheName = 'cache-v1' -// const resourceToPrecache = [ -// '/', -// 'index.html', -// '/css/', -// '/js/', -// '/pages/', -// '/fonts/' -// ] +const cacheName = 'cache-v1' +const resourceToPrecache = [ + '/', + 'index.html', + '/css/', + '/js/', + '/pages/', + '/fonts/' +] -// self.addEventListener('install', event => { -// console.log("Service Worker: Installed"); -// event.waitUntil( -// caches.open(cacheName) -// .then(cache => { -// return cache.addAll(resourceToPrecache) -// }) -// ) -// }) +self.addEventListener('install', event => { + console.log("Service Worker: Installed"); + event.waitUntil( + caches.open(cacheName) + .then(cache => { + return cache.addAll(resourceToPrecache) + }) + ) +}) -// self.addEventListener('fetch', event => { -// event.respondWith(catches.match(event.request) -// .then(cachedResponse => { -// return cachedResponse || fetch(event.request); -// }) -// ); -// });
\ No newline at end of file +self.addEventListener('fetch', event => { + event.respondWith(catches.match(event.request) + .then(cachedResponse => { + return cachedResponse || fetch(event.request); + }) + ); +});
\ No newline at end of file |
