emitter.removeAllListeners([eventName])
-
¥Returns: <EventEmitter>
删除所有监听器,或指定 eventName
的监听器。
¥Removes all listeners, or those of the specified eventName
.
删除在代码其他地方添加的监听器是不好的做法,特别是当 EventEmitter
实例是由其他组件或模块(例如套接字或文件流)创建时。
¥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).
返回对 EventEmitter
的引用,以便可以链式调用。
¥Returns a reference to the EventEmitter
, so that calls can be chained.