@inter-digital/wasm-client-sdk 3.8.3-patch.14-beta.1 → 3.8.3-patch.14-beta.2

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/lib/index.es.js CHANGED
@@ -1189,12 +1189,18 @@ class SDK extends Emitter {
1189
1189
  this.goExisted = false;
1190
1190
  this.tryParse = true;
1191
1191
  this.isLogStandardOutput = true;
1192
+ this.isInitialized = false;
1192
1193
  this.init = async (params, operationID = v4()) => {
1193
1194
  var _a, _b;
1194
1195
  this._logWrap(`SDK => (invoked by js) run init with args ${JSON.stringify({
1195
1196
  params,
1196
1197
  operationID,
1197
1198
  })}`);
1199
+ // Prevent multiple initialization calls
1200
+ if (this.isInitialized) {
1201
+ this._logWrap('SDK => init already called, skipping duplicate initialization');
1202
+ return Promise.resolve();
1203
+ }
1198
1204
  await workerPromise;
1199
1205
  await this.wasmInitializedPromise;
1200
1206
  window.commonEventFunc(event => {
@@ -1226,7 +1232,9 @@ class SDK extends Emitter {
1226
1232
  isExternalExtensions: params.isExternalExtensions || false,
1227
1233
  };
1228
1234
  this.tryParse = (_b = params.tryParse) !== null && _b !== void 0 ? _b : true;
1229
- return window.initSDK(operationID, JSON.stringify(config));
1235
+ const result = window.initSDK(operationID, JSON.stringify(config));
1236
+ this.isInitialized = true;
1237
+ return result;
1230
1238
  };
1231
1239
  this.login = async (params, operationID = v4()) => {
1232
1240
  this._logWrap(`SDK => (invoked by js) run login with args ${JSON.stringify({
@@ -2098,6 +2106,7 @@ class SDK extends Emitter {
2098
2106
  reset();
2099
2107
  initDatabaseAPI(debug);
2100
2108
  this.isLogStandardOutput = debug;
2109
+ this.isInitialized = false; // Reset initialization flag
2101
2110
  this.wasmInitializedPromise = initializeWasm(url);
2102
2111
  this.goExitPromise = getGoExitPromise();
2103
2112
  if (this.goExitPromise) {
@@ -2110,6 +2119,7 @@ class SDK extends Emitter {
2110
2119
  })
2111
2120
  .finally(() => {
2112
2121
  this.goExisted = true;
2122
+ this.isInitialized = false; // Reset when WASM exits
2113
2123
  });
2114
2124
  }
2115
2125
  }
package/lib/index.js CHANGED
@@ -1193,12 +1193,18 @@ class SDK extends Emitter {
1193
1193
  this.goExisted = false;
1194
1194
  this.tryParse = true;
1195
1195
  this.isLogStandardOutput = true;
1196
+ this.isInitialized = false;
1196
1197
  this.init = async (params, operationID = v4()) => {
1197
1198
  var _a, _b;
1198
1199
  this._logWrap(`SDK => (invoked by js) run init with args ${JSON.stringify({
1199
1200
  params,
1200
1201
  operationID,
1201
1202
  })}`);
1203
+ // Prevent multiple initialization calls
1204
+ if (this.isInitialized) {
1205
+ this._logWrap('SDK => init already called, skipping duplicate initialization');
1206
+ return Promise.resolve();
1207
+ }
1202
1208
  await workerPromise;
1203
1209
  await this.wasmInitializedPromise;
1204
1210
  window.commonEventFunc(event => {
@@ -1230,7 +1236,9 @@ class SDK extends Emitter {
1230
1236
  isExternalExtensions: params.isExternalExtensions || false,
1231
1237
  };
1232
1238
  this.tryParse = (_b = params.tryParse) !== null && _b !== void 0 ? _b : true;
1233
- return window.initSDK(operationID, JSON.stringify(config));
1239
+ const result = window.initSDK(operationID, JSON.stringify(config));
1240
+ this.isInitialized = true;
1241
+ return result;
1234
1242
  };
1235
1243
  this.login = async (params, operationID = v4()) => {
1236
1244
  this._logWrap(`SDK => (invoked by js) run login with args ${JSON.stringify({
@@ -2102,6 +2110,7 @@ class SDK extends Emitter {
2102
2110
  reset();
2103
2111
  initDatabaseAPI(debug);
2104
2112
  this.isLogStandardOutput = debug;
2113
+ this.isInitialized = false; // Reset initialization flag
2105
2114
  this.wasmInitializedPromise = initializeWasm(url);
2106
2115
  this.goExitPromise = getGoExitPromise();
2107
2116
  if (this.goExitPromise) {
@@ -2114,6 +2123,7 @@ class SDK extends Emitter {
2114
2123
  })
2115
2124
  .finally(() => {
2116
2125
  this.goExisted = true;
2126
+ this.isInitialized = false; // Reset when WASM exits
2117
2127
  });
2118
2128
  }
2119
2129
  }
package/lib/index.umd.js CHANGED
@@ -1195,12 +1195,18 @@
1195
1195
  this.goExisted = false;
1196
1196
  this.tryParse = true;
1197
1197
  this.isLogStandardOutput = true;
1198
+ this.isInitialized = false;
1198
1199
  this.init = async (params, operationID = v4()) => {
1199
1200
  var _a, _b;
1200
1201
  this._logWrap(`SDK => (invoked by js) run init with args ${JSON.stringify({
1201
1202
  params,
1202
1203
  operationID,
1203
1204
  })}`);
1205
+ // Prevent multiple initialization calls
1206
+ if (this.isInitialized) {
1207
+ this._logWrap('SDK => init already called, skipping duplicate initialization');
1208
+ return Promise.resolve();
1209
+ }
1204
1210
  await workerPromise;
1205
1211
  await this.wasmInitializedPromise;
1206
1212
  window.commonEventFunc(event => {
@@ -1232,7 +1238,9 @@
1232
1238
  isExternalExtensions: params.isExternalExtensions || false,
1233
1239
  };
1234
1240
  this.tryParse = (_b = params.tryParse) !== null && _b !== void 0 ? _b : true;
1235
- return window.initSDK(operationID, JSON.stringify(config));
1241
+ const result = window.initSDK(operationID, JSON.stringify(config));
1242
+ this.isInitialized = true;
1243
+ return result;
1236
1244
  };
1237
1245
  this.login = async (params, operationID = v4()) => {
1238
1246
  this._logWrap(`SDK => (invoked by js) run login with args ${JSON.stringify({
@@ -2104,6 +2112,7 @@
2104
2112
  reset();
2105
2113
  initDatabaseAPI(debug);
2106
2114
  this.isLogStandardOutput = debug;
2115
+ this.isInitialized = false; // Reset initialization flag
2107
2116
  this.wasmInitializedPromise = initializeWasm(url);
2108
2117
  this.goExitPromise = getGoExitPromise();
2109
2118
  if (this.goExitPromise) {
@@ -2116,6 +2125,7 @@
2116
2125
  })
2117
2126
  .finally(() => {
2118
2127
  this.goExisted = true;
2128
+ this.isInitialized = false; // Reset when WASM exits
2119
2129
  });
2120
2130
  }
2121
2131
  }
@@ -8,6 +8,7 @@ declare class SDK extends Emitter {
8
8
  private goExisted;
9
9
  private tryParse;
10
10
  private isLogStandardOutput;
11
+ private isInitialized;
11
12
  constructor(url?: string, debug?: boolean);
12
13
  _logWrap(...args: any[]): void;
13
14
  _invoker<T>(functionName: string, func: (...args: any[]) => Promise<any>, args: any[], processor?: (data: string) => string): Promise<WsResponse<T>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inter-digital/wasm-client-sdk",
3
- "version": "3.8.3-patch.14-beta.1",
3
+ "version": "3.8.3-patch.14-beta.2",
4
4
  "description": "open im sdk for web",
5
5
  "source": "src/index.ts",
6
6
  "main": "lib/index.js",