Conflicts resolved: - sw.js: bumped CACHE_NAME to dienstplan-pro-v4 (was v3 + v2). Both variants.js and image-import.js are in ASSETS. - storage.js: kept STORAGE_KEY_DUTIES + STORAGE_KEY_VACATION (Feature B) alongside STORAGE_KEY_OPENROUTER_KEY/MODEL + DEFAULT_MODEL (Feature A). - styles.css: appended Feature B variants/vacation/date-stepper rules after Feature A modal/key rules; both blocks coexist.
32 lines
686 B
JavaScript
32 lines
686 B
JavaScript
const CACHE_NAME = 'dienstplan-pro-v4';
|
|
const ASSETS = [
|
|
'./',
|
|
'./index.html',
|
|
'./styles.css',
|
|
'./app.js',
|
|
'./calculator.js',
|
|
'./variants.js',
|
|
'./holidays.js',
|
|
'./storage.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))
|
|
);
|
|
});
|