Skip to content

Commit

Permalink
fix: check if the navigator global is available before usage (#1755)
Browse files Browse the repository at this point in the history
  • Loading branch information
boschni committed Feb 6, 2021
1 parent 5bd3fa9 commit 7c08f33
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/onlineManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ class OnlineManager extends Subscribable {
return this.online
}

return navigator.onLine === undefined || navigator.onLine
if (
typeof navigator === 'undefined' ||
typeof navigator.onLine === 'undefined'
) {
return true
}

return navigator.onLine
}

private setDefaultEventListener() {
Expand Down

0 comments on commit 7c08f33

Please sign in to comment.