EventEmitter.off() 方法
移除事件监听器,使其不再触发。
签名
class EventEmitter {
off<Key extends keyof EventsWithWildcard<Events>>(
type: Key,
handler?: Handler<EventsWithWildcard<Events>[Key]>,
): this;
}
参数
|
参数 |
类型 |
说明 |
|---|---|---|
|
type |
Key |
你希望停止监听的事件类型。 |
|
handler |
Handler<EventsWithWildcard<Events>[Key]> |
(可选) 应被移除的函数。 |
返回值:
this
this 以便链式调用方法。