차량 모니터 서비스워커 해제

This commit is contained in:
seo
2026-07-22 01:06:29 +09:00
parent cf2c90e4ce
commit 413429b7e4
3 changed files with 19 additions and 14 deletions
+13 -8
View File
@@ -155,6 +155,18 @@
}).catch(function () {});
}
function unregisterServiceWorkers() {
if (!navigator.serviceWorker || !navigator.serviceWorker.getRegistrations) return Promise.resolve();
return navigator.serviceWorker.getRegistrations().then(function (registrations) {
return Promise.all(registrations.map(function (registration) {
return registration.unregister().catch(function () {});
}));
}).catch(function () {});
}
unregisterServiceWorkers();
function reloadWith(version) {
var token = version.slice(0, 12);
var marker = token + ':' + Math.floor(Date.now() / 10000);
@@ -163,14 +175,7 @@
if (assetTokenFromLocation() && sessionGet(reloadKey) === marker) return;
sessionSet(reloadKey, marker);
withTimeout(deleteCaches(), 2500).then(function () {
if (navigator.serviceWorker && navigator.serviceWorker.getRegistrations) {
navigator.serviceWorker.getRegistrations().then(function (registrations) {
registrations.forEach(function (registration) {
if (registration && typeof registration.update === 'function') registration.update();
});
}).catch(function () {});
}
withTimeout(Promise.all([deleteCaches(), unregisterServiceWorkers()]), 2500).then(function () {
window.location.replace(addQuery(window.location.href, 'assetReload', token));
});
}