28 lines
714 B
JavaScript
28 lines
714 B
JavaScript
const CACHE_NAME = 'veridian-v2';
|
|
const STATIC_ASSETS = [
|
|
'/',
|
|
'/manifest.json'
|
|
];
|
|
|
|
// Install event - skip waiting immediately to invalidate old cache
|
|
self.addEventListener('install', (event) => {
|
|
self.skipWaiting();
|
|
});
|
|
|
|
// Activate event - clean up ALL old caches
|
|
self.addEventListener('activate', (event) => {
|
|
event.waitUntil(
|
|
caches.keys().then((cacheNames) => {
|
|
return Promise.all(
|
|
cacheNames.map((name) => caches.delete(name))
|
|
);
|
|
})
|
|
);
|
|
self.clients.claim();
|
|
});
|
|
|
|
// Fetch event - network only, no caching (to prevent stale assets)
|
|
self.addEventListener('fetch', (event) => {
|
|
// Just pass through to network
|
|
return;
|
|
});
|