|
Last change
on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
420 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Assumes a browser is online if `undefined`, otherwise makes a best effort
|
|---|
| 3 | * @link https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/onLine
|
|---|
| 4 | */
|
|---|
| 5 | export function isOnline() {
|
|---|
| 6 | // We set the default config value in the store, so we'd need to check for this in a SSR env
|
|---|
| 7 | return typeof navigator === 'undefined'
|
|---|
| 8 | ? true
|
|---|
| 9 | : navigator.onLine === undefined
|
|---|
| 10 | ? true
|
|---|
| 11 | : navigator.onLine
|
|---|
| 12 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.