20 lines
459 B
JavaScript
20 lines
459 B
JavaScript
/* global globalThis, self */
|
|
|
|
'use strict';
|
|
|
|
(function () {
|
|
const globalApi = (typeof globalThis !== 'undefined' && globalThis) || self;
|
|
const naviApi = globalApi.navigator;
|
|
|
|
if (!naviApi.serviceWorker) return;
|
|
|
|
naviApi.serviceWorker.register('/sw.js', {
|
|
updateViaCache: 'none'
|
|
}).then((registration) => {
|
|
if (typeof registration.update !== 'function') return;
|
|
registration.update();
|
|
}, () => {
|
|
// registration failed
|
|
});
|
|
})();
|