Files
omnivore/packages/web/public/static/scripts/inject-sw.js
2022-02-11 09:24:33 -08:00

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
});
})();