@trtc/calls-uikit-react 4.2.2 → 4.2.3

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": "@trtc/calls-uikit-react",
3
- "version": "4.2.2",
3
+ "version": "4.2.3",
4
4
  "main": "./tuicall-uikit-react.umd.js",
5
5
  "module": "./tuicall-uikit-react.es.js",
6
6
  "types": "./types/index.d.ts",
@@ -14,9 +14,9 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@tencentcloud/tui-core-lite": "1.0.0",
17
- "@trtc/call-engine-lite-js": "~3.4.0",
17
+ "@trtc/call-engine-lite-js": "~3.4.5",
18
18
  "@tencentcloud/lite-chat": "^1.5.0",
19
- "@trtc/call-engine-lite-wx": "~3.4.3"
19
+ "@trtc/call-engine-lite-wx": "~3.4.5"
20
20
  },
21
21
  "bugs": {
22
22
  "url": "https://github.com/tencentyun/TUICallKit/issues"
@@ -26,7 +26,7 @@ const TUIGlobal: ITUIGlobal = TuiGlobal.getInstance();
26
26
  const TUIStore: ITUIStore = TuiStore.getInstance();
27
27
  const uiDesign = UIDesign.getInstance();
28
28
  uiDesign.setTUIStore(TUIStore);
29
- const version = '4.2.2';
29
+ const version = '4.2.3';
30
30
  const frameWork = 'react';
31
31
  export { TUIGlobal, TUIStore, uiDesign };
32
32
 
@@ -44,9 +44,17 @@ export default class TUICallService {
44
44
  private _permissionCheckTimer: any = null;
45
45
  private _chatCombine: any = null;
46
46
  private _engineEventHandler: any = null;
47
+ // wasm ready
48
+ private _wasmReadyPromise;
49
+ private _wasmReadyResolve;
50
+ private _isInitialized = false;
47
51
 
48
52
  constructor() {
49
53
  console.log(`${NAME.PREFIX}version: ${version}`);
54
+ this._wasmReadyPromise = new Promise(resolve => {
55
+ this._wasmReadyResolve = resolve;
56
+ });
57
+ this._loadWasm();
50
58
  this._watchTUIStore();
51
59
  this._engineEventHandler = EngineEventHandler.getInstance({ callService: this });
52
60
 
@@ -59,8 +67,23 @@ export default class TUICallService {
59
67
  }
60
68
  return TUICallService.instance;
61
69
  }
70
+ public _loadWasm() {
71
+ TUICallEngine.once('ready', () => this._wasmReadyResolve());
72
+ }
62
73
  @avoidRepeatedCall()
63
74
  public async init(params: IInitParams) {
75
+ if (this._isInitialized) {
76
+ console.warn('TUICallKit has already been initialized.');
77
+ return;
78
+ }
79
+ await this._wasmReadyPromise;
80
+
81
+ if (!this._isInitialized) {
82
+ this._doInit(params);
83
+ this._isInitialized = true;
84
+ }
85
+ }
86
+ public async _doInit(params: IInitParams) {
64
87
  try {
65
88
  if (this._tuiCallEngine) return;
66
89
  // @ts-ignore
@@ -109,6 +132,7 @@ export default class TUICallService {
109
132
  // component destroy
110
133
  public async destroyed() {
111
134
  try {
135
+ this._isInitialized = false;
112
136
  const currentCallStatus = TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS);
113
137
  if (currentCallStatus !== CallStatus.IDLE) {
114
138
  throw new Error(`please destroyed when status is idle, current status: ${currentCallStatus}`);
package/src/index.ts CHANGED
@@ -35,7 +35,7 @@ const TUICallType = {
35
35
  AUDIO_CALL: 1,
36
36
  VIDEO_CALL: 2,
37
37
  };
38
- const Version = '4.2.2'; // basic-demo 原来上报使用
38
+ const Version = '4.2.3'; // basic-demo 原来上报使用
39
39
 
40
40
  // 输出产物
41
41
  export {