From ec0164452c88ba96ce31b237a4a3082e1dc746b1 Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Fri, 2 Dec 2022 11:56:15 +0000 Subject: [PATCH] Register serviceworker --- src/main.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main.js b/src/main.js index e4a793f6..a7d9da83 100644 --- a/src/main.js +++ b/src/main.js @@ -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 {