22 lines
643 B
JavaScript
22 lines
643 B
JavaScript
// Minimal service worker — pass everything through, cache nothing
|
|
self.addEventListener('install', function() {
|
|
self.skipWaiting();
|
|
});
|
|
|
|
self.addEventListener('activate', function(event) {
|
|
// Clear all old caches
|
|
event.waitUntil(
|
|
caches.keys().then(function(names) {
|
|
return Promise.all(
|
|
names.map(function(name) { return caches.delete(name); })
|
|
);
|
|
})
|
|
);
|
|
});
|
|
|
|
self.addEventListener('fetch', function(event) {
|
|
// Only intercept same-origin requests — let external CDNs go through natively
|
|
if (event.request.url.startsWith(self.location.origin)) {
|
|
event.respondWith(fetch(event.request));
|
|
}
|
|
});
|