瀏覽代碼

fix. attachted more remove listener

matrixbirds 5 年之前
父節點
當前提交
1195755cb9
共有 3 個文件被更改,包括 5 次插入5 次删除
  1. 2
    2
      lib/RtcEngine.native.js
  2. 1
    1
      lib/RtcEngine.native.js.map
  3. 2
    2
      src/RtcEngine.native.ts

+ 2
- 2
lib/RtcEngine.native.js 查看文件

@@ -53,7 +53,7 @@ class RtcEngine {
53 53
      * @param eventType
54 54
      */
55 55
     static off(eventType) {
56
-        AgoraEventEmitter.removeAllListeners(eventType);
56
+        AgoraEventEmitter.removeListener(eventType, () => { });
57 57
         this.eventTypes.delete(eventType);
58 58
     }
59 59
     /**
@@ -65,7 +65,7 @@ class RtcEngine {
65 65
      */
66 66
     static removeAllListeners() {
67 67
         for (let eventType of this.eventTypes) {
68
-            AgoraEventEmitter.removeAllListeners(eventType);
68
+            AgoraEventEmitter.removeListener(eventType, () => { });
69 69
         }
70 70
         this.eventTypes.clear();
71 71
     }

+ 1
- 1
lib/RtcEngine.native.js.map
文件差異過大導致無法顯示
查看文件


+ 2
- 2
src/RtcEngine.native.ts 查看文件

@@ -86,7 +86,7 @@ class RtcEngine {
86 86
      * @param eventType
87 87
      */
88 88
     public static off(eventType: string) {
89
-        AgoraEventEmitter.removeAllListeners(eventType);
89
+        AgoraEventEmitter.removeListener(eventType, () => {});
90 90
         this.eventTypes.delete(eventType);
91 91
     }
92 92
 
@@ -99,7 +99,7 @@ class RtcEngine {
99 99
      */
100 100
     public static removeAllListeners() {
101 101
         for (let eventType of this.eventTypes) {
102
-            AgoraEventEmitter.removeAllListeners(eventType);
102
+            AgoraEventEmitter.removeListener(eventType, () => {});
103 103
         }
104 104
         this.eventTypes.clear();
105 105
     }