@lijuhong1981/jsevents 1.2.2 → 1.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 +1 -1
- package/src/EventEmitter.js +21 -0
- package/src/EventSubscriber.js +7 -0
package/package.json
CHANGED
package/src/EventEmitter.js
CHANGED
|
@@ -72,6 +72,13 @@ class EventEmitter extends Destroyable {
|
|
|
72
72
|
return this;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* @see removeAllListeners
|
|
77
|
+
*/
|
|
78
|
+
offAll() {
|
|
79
|
+
return this.removeAllListeners();
|
|
80
|
+
}
|
|
81
|
+
|
|
75
82
|
/**
|
|
76
83
|
* 判断是否已添加某类型的事件监听
|
|
77
84
|
* @param {any} type 事件类型
|
|
@@ -81,6 +88,13 @@ class EventEmitter extends Destroyable {
|
|
|
81
88
|
return this._dispatcher.hasEventListener(type);
|
|
82
89
|
}
|
|
83
90
|
|
|
91
|
+
/**
|
|
92
|
+
* @see hasListener
|
|
93
|
+
*/
|
|
94
|
+
has(type) {
|
|
95
|
+
return this.hasListener(type);
|
|
96
|
+
}
|
|
97
|
+
|
|
84
98
|
/**
|
|
85
99
|
* 获取某类型的所有事件监听器
|
|
86
100
|
* @param {any} type
|
|
@@ -90,6 +104,13 @@ class EventEmitter extends Destroyable {
|
|
|
90
104
|
return this._dispatcher.getEventListeners(type);
|
|
91
105
|
}
|
|
92
106
|
|
|
107
|
+
/**
|
|
108
|
+
* @see getListeners
|
|
109
|
+
*/
|
|
110
|
+
listeners(type) {
|
|
111
|
+
return this.getListeners(type);
|
|
112
|
+
}
|
|
113
|
+
|
|
93
114
|
/**
|
|
94
115
|
* 注册的事件数量
|
|
95
116
|
* @returns {number}
|
package/src/EventSubscriber.js
CHANGED