emitter.removeAllListeners([eventName])
eventName
<string> | <symbol>- 返回: <EventEmitter>
删除所有监听器,或指定 eventName
的监听器。
删除在代码其他地方添加的监听器是不好的做法,特别是当 EventEmitter
实例是由其他组件或模块(例如套接字或文件流)创建时。
返回对 EventEmitter
的引用,以便可以链式调用。
eventName
<string> | <symbol>- Returns: <EventEmitter>
Removes all listeners, or those of the specified eventName
.
It is bad practice to remove listeners added elsewhere in the code,
particularly when the EventEmitter
instance was created by some other
component or module (e.g. sockets or file streams).
Returns a reference to the EventEmitter
, so that calls can be chained.