Subh775's picture
RELEASE: auth; pf section added; bug/crash/ major improvements & fixes; refactoring pending..
5cd1866
raw
history blame contribute delete
676 Bytes
const CACHE_NAME = 'urbanflow-v4';
const ASSETS = [
'./css/initial.css',
'./css/vehicles.css',
'./css/shared.css',
'./css/auth.css',
'./assets/shuriken.png',
'./assets/shurkien_b.png',
'./assets/uf_rf.png'
];
self.addEventListener('install', (e) => {
e.waitUntil(caches.open(CACHE_NAME).then(c => c.addAll(ASSETS)));
});
self.addEventListener('fetch', (e) => {
const url = new URL(e.request.url);
// NEVER cache WebSockets or API calls
if (url.pathname.includes('/ws/') || url.pathname.includes('/reports/') || url.pathname.includes('/bundle/')) {
return;
}
e.respondWith(
fetch(e.request).catch(() => caches.match(e.request))
);
});