@lijuhong1981/jsevents 1.1.6 → 1.1.8

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,8 +1,8 @@
1
1
  {
2
2
  "name": "@lijuhong1981/jsevents",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "> TODO: description",
5
- "author": "lijuhong1981",
5
+ "author": "lijuhong1981 <lijuhong@hotmail.com>",
6
6
  "homepage": "https://github.com/lijuhong1981/jslibs#readme",
7
7
  "license": "ISC",
8
8
  "type": "module",
@@ -19,8 +19,8 @@
19
19
  "url": "https://github.com/lijuhong1981/jslibs/issues"
20
20
  },
21
21
  "dependencies": {
22
- "@lijuhong1981/jscheck": "^1.0.9",
23
- "@lijuhong1981/jsdestroy": "^1.1.9"
22
+ "@lijuhong1981/jscheck": "^1.0.10",
23
+ "@lijuhong1981/jsdestroy": "^1.1.10"
24
24
  },
25
- "gitHead": "d20df0ba5bb330d43c7828f8a97b41ca3860a570"
25
+ "gitHead": "c46541f47b63668952abb99d1edd73e9781418a9"
26
26
  }
@@ -34,8 +34,8 @@ function removeListener(events, type, callback) {
34
34
  if (callback) {
35
35
  event.removeEventListener(callback);
36
36
  } else {
37
- event.destroy();
38
37
  events.delete(type);
38
+ event.destroy();
39
39
  }
40
40
  }
41
41
  }
@@ -125,7 +125,7 @@ class EventDispatcher extends Destroyable {
125
125
 
126
126
  /**
127
127
  * 判断是否已添加某类型的事件监听器
128
- * @param {string|object} type 事件类型
128
+ * @param {any} type 事件类型
129
129
  * @returns {boolean} 判断结果
130
130
  */
131
131
  hasEventListener(type) {
@@ -151,18 +151,18 @@ class EventDispatcher extends Destroyable {
151
151
 
152
152
  /**
153
153
  * 发送事件参数
154
- * @param {string|object} type 事件类型
154
+ * @param {any} type 事件类型
155
155
  * @param {...any} ...args 事件参数
156
156
  * @returns {this}
157
157
  */
158
158
  dispatch(type, ...args) {
159
159
  Check.valid('type', type);
160
160
 
161
- const event = this._events.get(type);
162
- if (event)
163
- event.raiseEvent(type, ...args);
161
+ const _event = this._events.get(type);
162
+ if (_event)
163
+ _event.raiseEvent(type, ...args);
164
164
  else {
165
- console.warn('Not found the ' + type + ' type`s event.');
165
+ console.warn('Not found the type`s event.', type);
166
166
  }
167
167
 
168
168
  return this;
@@ -171,6 +171,7 @@ class EventDispatcher extends Destroyable {
171
171
  /**
172
172
  * 发送事件对象
173
173
  * @param {object} event 事件对象
174
+ * @param {any} event.type 事件类型,必填项
174
175
  * @param {object} owner 事件对象所有者,可不填
175
176
  * @returns {this}
176
177
  */
@@ -180,11 +181,11 @@ class EventDispatcher extends Destroyable {
180
181
 
181
182
  event.owner = event.owner || owner || this;
182
183
 
183
- const event = this._events.get(event.type);
184
- if (event)
185
- event.raiseEvent(event);
184
+ const _event = this._events.get(event.type);
185
+ if (_event)
186
+ _event.raiseEvent(event);
186
187
  else {
187
- console.warn('Not found the ' + type + ' type`s event.');
188
+ console.warn('Not found the type`s event.', event.type);
188
189
  }
189
190
 
190
191
  return this;