forked from jsnbuchanan/crowd-funder-for-time-pwa
avoid error on browsers without a service worker
This commit is contained in:
@@ -353,7 +353,7 @@ export default class App extends Vue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// there may be a long pause here on first initialization
|
// there may be a long pause here on first initialization
|
||||||
navigator.serviceWorker.ready.then(() => {
|
navigator.serviceWorker?.ready.then(() => {
|
||||||
this.serviceWorkerReady = true;
|
this.serviceWorkerReady = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -443,7 +443,7 @@ export default class App extends Vue {
|
|||||||
this.subscribeToPush()
|
this.subscribeToPush()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log("Subscribed successfully.");
|
console.log("Subscribed successfully.");
|
||||||
return navigator.serviceWorker.ready;
|
return navigator.serviceWorker?.ready;
|
||||||
})
|
})
|
||||||
.then((registration) => {
|
.then((registration) => {
|
||||||
return registration.pushManager.getSubscription();
|
return registration.pushManager.getSubscription();
|
||||||
@@ -575,7 +575,7 @@ export default class App extends Vue {
|
|||||||
|
|
||||||
async turnOffNotifications() {
|
async turnOffNotifications() {
|
||||||
let subscription;
|
let subscription;
|
||||||
const pushProviderSuccess = await navigator.serviceWorker.ready
|
const pushProviderSuccess = await navigator.serviceWorker?.ready
|
||||||
.then((registration) => {
|
.then((registration) => {
|
||||||
return registration.pushManager.getSubscription();
|
return registration.pushManager.getSubscription();
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user