@reactoo/watchtogether-sdk-js 2.7.70 → 2.7.71

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.7.70",
3
+ "version": "2.7.71",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "dist/watchtogether-sdk.min.js",
6
6
  "module": "dist/watchtogether-sdk.min.js",
@@ -32,7 +32,7 @@ class Iot {
32
32
 
33
33
  terminateWorker() {
34
34
  this.log('iot terminateWorker');
35
- this.worker.terminate();
35
+ this.worker?.terminate();
36
36
  }
37
37
 
38
38
  connect(apiMqttUrl, apiMqttClientId, region, accessKeyId, secretAccessKey, sessionToken, expiration) {
@@ -129,6 +129,12 @@ class Iot {
129
129
  }
130
130
 
131
131
  isConnected() {
132
+
133
+ if(!this.worker) {
134
+ this.log('Worker not initialized');
135
+ return Promise.reject(new Error('Worker not initialized', {cause: -1}));
136
+ }
137
+
132
138
  return new Promise((resolve) => {
133
139
  const handleIsConnectedResult = (event) => {
134
140
  this.off('worker:is_connected_result', handleIsConnectedResult);