@reactoo/watchtogether-sdk-js 2.7.42-beta.3 → 2.7.43
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
package/src/models/iot.js
CHANGED
|
@@ -16,10 +16,11 @@ let iot = function () {
|
|
|
16
16
|
this.__privates.iot.log('Updating Credentials...');
|
|
17
17
|
interruptCount = 0;
|
|
18
18
|
isReconnecting = true;
|
|
19
|
+
this.iot.$emit('isReconnecting', isReconnecting);
|
|
19
20
|
return new Promise((resolve, reject) => {
|
|
20
21
|
const timeoutId = setTimeout(() => {
|
|
21
22
|
reject(new Error('Updating Credentials Timeout...'));
|
|
22
|
-
},
|
|
23
|
+
}, 10000); // 10 seconds timeout is enough
|
|
23
24
|
this.iot.getCredentials()
|
|
24
25
|
.then(response => this.__privates.iot.updateWebSocketCredentials(
|
|
25
26
|
response.data.credentials.accessKeyId,
|
|
@@ -38,6 +39,7 @@ let iot = function () {
|
|
|
38
39
|
})
|
|
39
40
|
}).finally(() => {
|
|
40
41
|
isReconnecting = false;
|
|
42
|
+
this.iot.$emit('isReconnecting', isReconnecting);
|
|
41
43
|
});
|
|
42
44
|
},
|
|
43
45
|
|
|
@@ -200,22 +202,20 @@ let iot = function () {
|
|
|
200
202
|
$off: (key, callback, that) => {
|
|
201
203
|
return this.__privates.iot.off(key, callback, that || this);
|
|
202
204
|
},
|
|
203
|
-
|
|
204
205
|
$clear: () => {
|
|
205
206
|
return this.__privates.iot.clear();
|
|
206
207
|
},
|
|
208
|
+
$emit: (key, ...args) => {
|
|
209
|
+
return this.__privates.iot.emit(key, ...args);
|
|
210
|
+
},
|
|
207
211
|
|
|
208
212
|
checkConnection: () => {
|
|
209
213
|
return this.__privates.iot.checkConnection()
|
|
210
214
|
.catch(error => {
|
|
211
|
-
|
|
212
|
-
console.log(shouldBeConnected, isReconnecting);
|
|
213
|
-
|
|
214
|
-
if(!shouldBeConnected || isReconnecting) {
|
|
215
|
+
if(!shouldBeConnected) {
|
|
215
216
|
this.__privates.iot.log('Ignoring connection check failure, not connected');
|
|
216
217
|
return Promise.resolve();
|
|
217
218
|
}
|
|
218
|
-
|
|
219
219
|
this.__privates.iot.log('Connection check failed:', error);
|
|
220
220
|
return this.iot.__updateCredentials();
|
|
221
221
|
});
|