Check if we have a service worker available before trying to communicate with it
This commit is contained in:
parent
83fcd72976
commit
8a7ecfa3bb
1 changed files with 10 additions and 8 deletions
|
@ -329,13 +329,15 @@
|
|||
// Service worker communication
|
||||
document.addEventListener(swEvents.SW_UPDATED, this.showRefreshUI, {once: true})
|
||||
|
||||
if (navigator && navigator.serviceWorker) {
|
||||
navigator.serviceWorker.addEventListener(
|
||||
'controllerchange', () => {
|
||||
if (this.refreshing) return;
|
||||
this.refreshing = true;
|
||||
window.location.reload();
|
||||
}
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
// Try renewing the token every time vikunja is loaded initially
|
||||
// (When opening the browser the focus event is not fired)
|
||||
|
|
Loading…
Reference in a new issue