Spaces:
Running
Running
File size: 676 Bytes
091ea0d 5cd1866 091ea0d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 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))
);
});
|