diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-01-16 10:59:07 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-01-16 10:59:07 +0800 |
| commit | b1e28ca6b273eccb45e1e7312ce79386b7cdf1c0 (patch) | |
| tree | fff8a90523f71c2826921ff1127d0afbed055ef8 /src/sw.js | |
| parent | 47daa63dcacda5b10085c94d7b67fe3cb2a6d8b0 (diff) | |
added compiled sw.js from src/sw.js -> public/sw.js
Diffstat (limited to 'src/sw.js')
| -rw-r--r-- | src/sw.js | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/sw.js b/src/sw.js new file mode 100644 index 00000000..26cc14a0 --- /dev/null +++ b/src/sw.js @@ -0,0 +1,57 @@ +const cacheName = 'cache-v1' +const resourceToPrecache = [ + '/', + '/index.html', + '/404.html', + '/pages/info/about.html', + '/pages/repo/github/repos.html', + '/css/style.css', + '/css/404.css', + '/css/index.css', + '/css/ghrepo.css', + '/css/about.css', + '/css/devicon.min.css', + '/js/main.js', + '/js/about.js', + '/js/dynamicBlob.js', + '/js/getrepo.js', + '/js/hacktype.js', + '/js/header.js', + '/js/index.js', + '/js/mouseblob.js', + '/js/randomblob.js', + '/js/rbg.js', + '/js/tilt.conf.js', + '/js/tilt.conf.noglare.js', + '/js/tilt.js', + '/js/2dtilt.js', + '/fonts/Hacked-KerX.ttf', + '/fonts/SmoothElegantRegular-ZLv3.ttf', + '/fonts/LigaJetBrainsMonoNerdFont-Regular.ttf', + '/fonts/Big500-8MLOM.ttf', + '/fonts/Monoton.ttf', + '/fonts/RockSalt-Regular.ttf', + '/fonts/audiowide.ttf' + // '/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('fetch', event => { + event.respondWith(caches.match(event.request) + .then(cachedResponse => { + return cachedResponse || fetch(event.request); + }) + ); +});
\ No newline at end of file |
