|
@@ -41,6 +41,11 @@ const AgoraEventEmitter = new NativeEventEmitter(Agora);
|
41
|
41
|
*/
|
42
|
42
|
class RtcEngine {
|
43
|
43
|
|
|
44
|
+ /**
|
|
45
|
+ * @ignore eventTypes
|
|
46
|
+ */
|
|
47
|
+ private static readonly _eventTypes: Set<string> = new Set<string>();
|
|
48
|
+
|
44
|
49
|
/**
|
45
|
50
|
* @ignore AG_PREFIX
|
46
|
51
|
*/
|
|
@@ -228,6 +233,7 @@ class RtcEngine {
|
228
|
233
|
* @return any
|
229
|
234
|
*/
|
230
|
235
|
public static on(eventType: string, listener: (...args: any[]) => any): any {
|
|
236
|
+ this._eventTypes.add(`${RtcEngine.AG_PREFIX}${eventType}`);
|
231
|
237
|
// convert int32 to uint32
|
232
|
238
|
if ([
|
233
|
239
|
'joinChannelSuccess',
|
|
@@ -379,7 +385,12 @@ class RtcEngine {
|
379
|
385
|
* @return void
|
380
|
386
|
*/
|
381
|
387
|
public static destroy() {
|
382
|
|
- Agora.removeAllListeners();
|
|
388
|
+ if (this._eventTypes.size) {
|
|
389
|
+ for (let eventType of this._eventTypes) {
|
|
390
|
+ AgoraEventEmitter.removeAllListeners(eventType);
|
|
391
|
+ }
|
|
392
|
+ this._eventTypes.clear()
|
|
393
|
+ }
|
383
|
394
|
return Agora.destroy();
|
384
|
395
|
}
|
385
|
396
|
|