- corretta configurazione
- fix problemi al database su piuchebuono una chiamata dava errore...
const c = ....
if (mycart && mycart.length > 0) {
This commit is contained in:
@@ -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();
|
||||
})()
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user