Files
DataStack/public/sw.js
T
Md Najmul d39d9f92f9 docs: update AI Studio design token audits
Refresh design token inventory files to reflect the latest UI sizing and layout configurations from the sandbox prototype.
2026-10-23 11:43:49 -05:00

35 lines
892 B
JavaScript

const CACHE_NAME = 'datastack-cache-v1';
const STATIC_ASSETS = ['/', '/vcon/dashboard', '/manifest.json'];
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open(CACHE_NAME).then((cache) => {
return cache.addAll(STATIC_ASSETS).catch(() => {});
})
);
self.skipWaiting();
});
self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys().then((keys) => {
return Promise.all(
keys.filter((key) => key !== CACHE_NAME).map((key) => caches.delete(key))
);
})
);
self.clients.claim();
});
self.addEventListener('fetch', (event) => {
// Let WebSocket and API requests pass through
if (event.request.url.includes('/socket.io/') || event.request.url.includes('/api/')) {
return;
}
event.respondWith(
fetch(event.request).catch(() => {
return caches.match(event.request);
})
);
});