Download sw.js from Snapkitty/woz-vault: direct link, hf CLI and curl.
- Browser
- Download file 624 Bytes
-
https://huggingface.co/Snapkitty/woz-vault/resolve/main/sw.js
- Command line
-
hf download hf://Snapkitty/woz-vault/sw.js
-
curl -L -o sw.js https://huggingface.co/Snapkitty/woz-vault/resolve/main/sw.js
624 Bytes
| const CACHE = 'woz-vault-v1' | |
| const CORE = ['/woz-vault/', '/woz-vault/index.html', '/woz-vault/app.js', '/woz-vault/styles.css'] | |
| self.addEventListener('install', e => { | |
| self.skipWaiting() | |
| e.waitUntil(caches.open(CACHE).then(c => c.addAll(CORE).catch(() => {}))) | |
| }) | |
| self.addEventListener('activate', e => { | |
| e.waitUntil(caches.keys().then(keys => Promise.all(keys.filter(k => k !== CACHE).map(k => caches.delete(k))))) | |
| self.clients.claim() | |
| }) | |
| self.addEventListener('fetch', e => { | |
| e.respondWith(caches.match(e.request).then(r => r || fetch(e.request).catch(() => caches.match('/woz-vault/')))) | |
| }) | |