FIX: Attempt to connect with navigator.onLine is initially false (#22981)
This commit is contained in:
parent
1d58dcac1f
commit
14348fc2f5
|
@ -13,8 +13,6 @@ export default class NetworkConnectivity extends Service {
|
|||
constructor() {
|
||||
super(...arguments);
|
||||
|
||||
this.setConnectivity(navigator.onLine);
|
||||
|
||||
window.addEventListener("offline", () => {
|
||||
this.setConnectivity(false);
|
||||
this.startTimerToCheckNavigator();
|
||||
|
@ -23,6 +21,10 @@ export default class NetworkConnectivity extends Service {
|
|||
window.addEventListener("online", this.pingServerAndSetConnectivity);
|
||||
|
||||
window.addEventListener("visibilitychange", this.onFocus);
|
||||
|
||||
if (!navigator.onLine) {
|
||||
this.pingServerAndSetConnectivity();
|
||||
}
|
||||
}
|
||||
|
||||
@bind
|
||||
|
|
Loading…
Reference in New Issue