@lijuhong1981/jsevents 1.2.2 → 1.2.4

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": "@lijuhong1981/jsevents",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "> TODO: description",
5
5
  "author": "lijuhong1981 <lijuhong@hotmail.com>",
6
6
  "homepage": "https://github.com/lijuhong1981/jslibs#readme",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@lijuhong1981/jscheck": "^1.1.3",
23
- "@lijuhong1981/jsdestroy": "^1.2.1"
23
+ "@lijuhong1981/jsdestroy": "^1.2.2"
24
24
  },
25
- "gitHead": "11a1d49d8302089d97ed1c37cdbfa8a231d3ef0c"
25
+ "gitHead": "7b5cde163f1bd7339a89592c4b09b949ef3f6772"
26
26
  }
@@ -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}
@@ -80,6 +80,13 @@ class EventSubscriber extends Destroyable {
80
80
  return this._listenersMap.delete(callback);
81
81
  }
82
82
 
83
+ /**
84
+ * @see hasEventListener
85
+ */
86
+ has(callback) {
87
+ return this.hasEventListener(callback);
88
+ }
89
+
83
90
  /**
84
91
  * @see addEventListener
85
92
  */