Fix: SW skipWaiting() sofort beim Install — kein Warten auf Cache, Update greift sofort, SW by-v562
This commit is contained in:
parent
c657ac6ab8
commit
f8861f3939
2 changed files with 3 additions and 3 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Offline-Cache + Push Notifications + Tile-Cache
|
||||
============================================================ */
|
||||
|
||||
const CACHE_VERSION = 'by-v561';
|
||||
const CACHE_VERSION = 'by-v562';
|
||||
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
||||
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
||||
const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache
|
||||
|
|
@ -134,13 +134,13 @@ function _isCacheableGet(pathname) {
|
|||
// INSTALL — App Shell cachen
|
||||
// ----------------------------------------------------------
|
||||
self.addEventListener('install', event => {
|
||||
self.skipWaiting(); // Sofort übernehmen — kein Warten auf Cache-Aufbau
|
||||
event.waitUntil(
|
||||
caches.open(CACHE_STATIC)
|
||||
.then(cache => cache.addAll(STATIC_ASSETS))
|
||||
.then(() => caches.open(CACHE_API).then(c =>
|
||||
fetch('/api/training/exercises').then(r => { if (r.ok) c.put('/api/training/exercises', r); }).catch(() => {})
|
||||
))
|
||||
.then(() => self.skipWaiting())
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue