Files
simtrace-analyser/frontend/sw.js
T
catarrh a0a2251522 Scrollbars: one 12px style for every pane
- the APDU list's 12px rule is folded into the global scrollbar style, so
  the side panel, APDU detail pane, dialogs (file-diff body), session
  lists/grid and the hex views' horizontal bars all use the same 12px bar
  with a 6px rounded thumb — no per-element overrides remain to drift,
  and the horizontal bars get an explicit height instead of the browser
  default
- Node test pins the global rule (12px width/height, 6px thumb radius) and
  the absence of per-element overrides; 527 Python + 55 Node tests
- SW cache simtrace-analyser-v75 (cosmetic, no version bump)
2026-10-17 23:08:40 +03:00

49 lines
1.4 KiB
JavaScript

const CACHE = 'simtrace-analyser-v75';
const PRECACHE = [
'index.html',
'manifest.json',
'icon-192.png',
'icon-512.png',
'favicon.png',
'sim-analyser.svg',
'sim-analyser-light.svg',
];
self.addEventListener('install', e => {
self.skipWaiting();
e.waitUntil(
caches.open(CACHE)
.then(cache => cache.addAll(PRECACHE))
.then(() => console.log('SW: precache done'))
.catch(err => console.error('SW: precache failed', err))
);
});
self.addEventListener('activate', e => {
e.waitUntil(
caches.keys()
.then(keys => Promise.all(
keys.filter(k => k !== CACHE).map(k => caches.delete(k))
))
.then(() => self.clients.claim())
.then(() => console.log('SW: activated, controlling clients'))
);
});
self.addEventListener('fetch', e => {
// Network-first: the local server is always up, so always serve fresh
// content and fall back to cache only when offline.
if (!e.request.url.startsWith('http')) return;
if (e.request.method !== 'GET') return;
e.respondWith(
fetch(e.request)
.then(r => {
const clone = r.clone();
caches.open(CACHE).then(c => c.put(e.request, clone)).catch(() => {});
return r;
})
.catch(() => caches.match(e.request))
);
});