Dienstplan-Pro/sw.js
Kenearos 67a3f4b546 feat(sync): Frontend pusht Aenderungen und laedt Server-Stand beim Start
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 15:59:48 +02:00

33 lines
701 B
JavaScript

const CACHE_NAME = 'dienstplan-pro-v5';
const ASSETS = [
'./',
'./index.html',
'./styles.css',
'./app.js',
'./calculator.js',
'./variants.js',
'./holidays.js',
'./storage.js',
'./sync.js',
'./image-import.js'
];
self.addEventListener('install', (e) => {
e.waitUntil(
caches.open(CACHE_NAME).then((cache) => cache.addAll(ASSETS))
);
});
self.addEventListener('activate', (e) => {
e.waitUntil(
caches.keys().then((keys) =>
Promise.all(keys.filter((k) => k !== CACHE_NAME).map((k) => caches.delete(k)))
)
);
});
self.addEventListener('fetch', (e) => {
e.respondWith(
caches.match(e.request).then((response) => response || fetch(e.request))
);
});