Register serviceworker

This commit is contained in:
FloatingGhost 2022-12-02 11:56:15 +00:00 committed by hynet-mel
parent 3da3e09dc5
commit ec0164452c

View file

@ -51,6 +51,17 @@ const persistedStateOptions = {
};
(async () => {
if ('serviceWorker' in navigator) {
// declaring scope manually
navigator.serviceWorker.register('/sw.js', {scope: '/'}).then((registration) => {
console.log('Service worker registration succeeded:', registration);
}, /*catch*/ (error) => {
console.error(`Service worker registration failed: ${error}`);
});
} else {
console.error('Service workers are not supported.');
}
let storageError = false
const plugins = [pushNotifications]
try {