@24i/bigscreen-sdk 1.0.34-alpha.2568 → 1.0.34-alpha.2570
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -18,10 +18,8 @@ import { LEFT, RIGHT, UP, DOWN, ENTER, BACK, ESC } from './KeyMap';
|
|
|
18
18
|
export const STORAGE_UUID_KEY = '__UUID__';
|
|
19
19
|
|
|
20
20
|
const DEFAULT_POLLING_INTERVAL = 15000;
|
|
21
|
-
const DEFAULT_POLLING_TIMEOUT = 10000;
|
|
22
|
-
const SUCCESS_STATUS_CODE = 200;
|
|
23
21
|
|
|
24
|
-
const
|
|
22
|
+
const CHECKED_URL = 'http://www.google-analytics.com/__utm.gif';
|
|
25
23
|
|
|
26
24
|
export abstract class DeviceBase<
|
|
27
25
|
CustomEventMap extends EventMapType = {},
|
|
@@ -50,8 +48,6 @@ export abstract class DeviceBase<
|
|
|
50
48
|
|
|
51
49
|
pollingInterval: number = DEFAULT_POLLING_INTERVAL;
|
|
52
50
|
|
|
53
|
-
pollingTimeout: number = DEFAULT_POLLING_TIMEOUT;
|
|
54
|
-
|
|
55
51
|
// MARK: Initialization
|
|
56
52
|
|
|
57
53
|
/**
|
|
@@ -84,27 +80,25 @@ export abstract class DeviceBase<
|
|
|
84
80
|
}
|
|
85
81
|
|
|
86
82
|
doOnlineCheck = () => {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
http.send();
|
|
83
|
+
const tester = new Image();
|
|
84
|
+
tester.onload = this.connectionFound;
|
|
85
|
+
tester.onerror = this.connectionNotFound;
|
|
86
|
+
tester.src = `${CHECKED_URL}?ts=${Date.now()}`;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
connectionFound = () => {
|
|
90
|
+
this.triggerEvent('networkchange',
|
|
91
|
+
{ isConnected: true } as any);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
connectionNotFound = () => {
|
|
95
|
+
this.triggerEvent('networkchange',
|
|
96
|
+
{ isConnected: false } as any);
|
|
102
97
|
};
|
|
103
98
|
|
|
104
99
|
checkNetworkConnection() {
|
|
105
100
|
const networkConfig: any = config.get('network.checkConnection');
|
|
106
101
|
this.pollingInterval = Number(networkConfig?.pollingInterval);
|
|
107
|
-
this.pollingTimeout = Number(networkConfig?.pollingTimeout);
|
|
108
102
|
window.setInterval(
|
|
109
103
|
this.doOnlineCheck,
|
|
110
104
|
this.pollingInterval || DEFAULT_POLLING_INTERVAL,
|