Spaces:
Runtime error
Runtime error
| export async function registerServiceWorker() { | |
| if (!("serviceWorker" in navigator)) { | |
| return; | |
| } | |
| try { | |
| const registrations = await navigator.serviceWorker.getRegistrations(); | |
| await Promise.all(registrations.map((registration) => registration.unregister())); | |
| if ("caches" in window) { | |
| const cacheNames = await window.caches.keys(); | |
| await Promise.all( | |
| cacheNames | |
| .filter((name) => name.startsWith("oapix-static")) | |
| .map((name) => window.caches.delete(name)) | |
| ); | |
| } | |
| } catch (error) { | |
| console.error("service worker cleanup failed", error); | |
| } | |
| } | |