EventEmitter.removeAllListeners() 方法
🌐 EventEmitter.removeAllListeners() method
移除所有监听器。如果提供了事件参数,它将只移除该事件的监听器。
🌐 Removes all listeners. If given an event argument, it will remove only listeners for that event.
语法
🌐 Signature
class EventEmitter {
removeAllListeners(type?: keyof EventsWithWildcard<Events>): this;
}
参数
🌐 Parameters
范围 🌐 Parameter | 类型 🌐 Type | 描述 🌐 Description |
|---|---|---|
type | keyof EventsWithWildcard<Events> | (可选) 要移除监听器的事件。 🌐 (Optional) the event to remove listeners for. |
返回:
this
this 使你能够串联方法调用。