console.log("Cleanup script is attempting to run..."); var isDirty = false; caches.keys().then((cacheNames) => { cacheNames.forEach((value) => { console.log('Deleting cache:', value); caches.delete(value); isDirty = true; }); }); navigator.serviceWorker.getRegistrations().then(function (registrations) { for (let registration of registrations) { console.log('Unregistering service worker:', registration.scope); registration.unregister(); isDirty = true; } }); if (isDirty) { console.log('Reloading window after cleanup...'); window.location.reload(); }