forked from AkkomaGang/akkoma-fe
Register serviceworker
This commit is contained in:
parent
6af1df8bef
commit
e132814478
1 changed files with 11 additions and 0 deletions
11
src/main.js
11
src/main.js
|
@ -51,6 +51,17 @@ const persistedStateOptions = {
|
||||||
};
|
};
|
||||||
|
|
||||||
(async () => {
|
(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
|
let storageError = false
|
||||||
const plugins = [pushNotifications]
|
const plugins = [pushNotifications]
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue