- corretta configurazione

- fix problemi al database su piuchebuono una chiamata dava errore...
const c = ....
if (mycart && mycart.length > 0) {
This commit is contained in:
Surya Paolo
2025-03-10 19:58:57 +01:00
parent e853fd23c2
commit cc541b1e6f
50 changed files with 1240 additions and 55 deletions

View File

@@ -31,9 +31,6 @@ import { CacheableResponsePlugin } from 'workbox-cacheable-response';
import { ExpirationPlugin } from 'workbox-expiration';
setCacheNameDetails({
prefix: self.location.hostname,
suffix: 'v1',
@@ -60,18 +57,24 @@ self.addEventListener('install', () => {
console.log('Service Worker: Skip...');
self.skipWaiting()
});
self.addEventListener('activate', (event) => {
clientsClaim();
console.log('Service Worker: Activated');
// Pulizia delle cache obsolete durante l'attivazione
event.waitUntil(
(async () => {
const cacheNames = await caches.keys();
await Promise.all(
cacheNames.map(cacheName => {
cacheNames.map((cacheName) => {
if (!cacheName.startsWith(`${self.location.hostname}-v1`)) {
return caches.delete(cacheName);
}
})
);
// Reclama immediatamente il controllo delle pagine
self.clients.claim();
})()
);
});