Spaces:
Sleeping
Sleeping
| const CACHE_NAME = 'engine-sound-classifier-v1'; | |
| const ASSETS_TO_CACHE = [ | |
| '/', | |
| '/index.html', | |
| '/static/manifest.json', | |
| '/static/icons/icon-192x192.png', | |
| '/static/icons/icon-512x512.png', | |
| 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap' | |
| ]; | |
| self.addEventListener('install', (event) => { | |
| event.waitUntil( | |
| caches.open(CACHE_NAME) | |
| .then((cache) => cache.addAll(ASSETS_TO_CACHE)) | |
| ); | |
| }); | |
| self.addEventListener('fetch', (event) => { | |
| event.respondWith( | |
| caches.match(event.request) | |
| .then((response) => { | |
| if (response) { | |
| return response; | |
| } | |
| return fetch(event.request); | |
| }) | |
| ); | |
| }); | |