From 61c3a0e30b5963ac70e49d303f196042dcd68020 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sat, 3 Feb 2024 19:19:58 -0700 Subject: [PATCH] avoid error on browsers without a service worker --- src/App.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/App.vue b/src/App.vue index 63d847da7..2d8935fa0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -353,7 +353,7 @@ export default class App extends Vue { } } // there may be a long pause here on first initialization - navigator.serviceWorker.ready.then(() => { + navigator.serviceWorker?.ready.then(() => { this.serviceWorkerReady = true; }); } @@ -443,7 +443,7 @@ export default class App extends Vue { this.subscribeToPush() .then(() => { console.log("Subscribed successfully."); - return navigator.serviceWorker.ready; + return navigator.serviceWorker?.ready; }) .then((registration) => { return registration.pushManager.getSubscription(); @@ -575,7 +575,7 @@ export default class App extends Vue { async turnOffNotifications() { let subscription; - const pushProviderSuccess = await navigator.serviceWorker.ready + const pushProviderSuccess = await navigator.serviceWorker?.ready .then((registration) => { return registration.pushManager.getSubscription(); })