We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EventEmitter/eventEmitter.js
Line 100 in adef06a
splice从第三个参数开始不是要进行添加元素的操作么?为什么删除对应的事件后,还要把null添加进去,不太理解
splice
null
The text was updated successfully, but these errors were encountered:
应该用不着
Sorry, something went wrong.
主要用在这里
proto.emit = function(eventName, args) { var listeners = this.__events[eventName]; if (!listeners) return; for (var i = 0; i < listeners.length; i++) { var listener = listeners[i]; if (listener) { listener.listener.apply(this, args || []); if (listener.once) { ---> this.off(eventName, listener.listener) } } } return this; };
如果不填充一个null,而是直接删除的话,那下一次循环的时候会少执行一个回调
No branches or pull requests
EventEmitter/eventEmitter.js
Line 100 in adef06a
splice
从第三个参数开始不是要进行添加元素的操作么?为什么删除对应的事件后,还要把null
添加进去,不太理解The text was updated successfully, but these errors were encountered: