Skip to content

Commit 20830cf

Browse files
committed
fix: add protection for navigator
1 parent ff4b387 commit 20830cf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libs/web-preset.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
function isOnline(): boolean {
2-
if (typeof navigator.onLine !== 'undefined') {
2+
if (
3+
typeof navigator !== 'undefined' &&
4+
typeof navigator.onLine !== 'undefined'
5+
) {
36
return navigator.onLine
47
}
58
// always assume it's online

0 commit comments

Comments
 (0)