Spaces:
Running
Running
Download sw.js from GamesAndFun/GAF1: direct link, hf CLI and curl.
- Browser
- Download file 703 Bytes
-
https://huggingface.co/spaces/GamesAndFun/GAF1/resolve/main/sw.js
- Command line
-
hf download hf://spaces/GamesAndFun/GAF1/sw.js
-
curl -L -o sw.js https://huggingface.co/spaces/GamesAndFun/GAF1/resolve/main/sw.js
703 Bytes
| const CACHE_NAME = 'pos-auto-cache-v1'; | |
| self.addEventListener('install', (e) => { | |
| self.skipWaiting(); | |
| }); | |
| self.addEventListener('activate', (e) => { | |
| e.waitUntil(self.clients.claim()); | |
| }); | |
| // Otomatis simpan file HTML apa pun yang pernah dibuka saat online | |
| self.addEventListener('fetch', (e) => { | |
| if (e.request.method !== 'GET') return; | |
| e.respondWith( | |
| fetch(e.request) | |
| .then((networkResponse) => { | |
| const responseClone = networkResponse.clone(); | |
| caches.open(CACHE_NAME).then((cache) => { | |
| cache.put(e.request, responseClone); | |
| }); | |
| return networkResponse; | |
| }) | |
| .catch(() => caches.match(e.request)) | |
| ); | |
| }); | |