Skip to main content
Version: 25.3.0

EventEmitter.off() 方法

🌐 EventEmitter.off() method

从触发中删除事件监听器。

🌐 Remove an event listener from firing.

语法

🌐 Signature

class EventEmitter {
off<Key extends keyof EventsWithWildcard<Events>>(
type: Key,
handler?: Handler<EventsWithWildcard<Events>[Key]>,
): this;
}

参数

🌐 Parameters

范围

🌐 Parameter

类型

🌐 Type

描述

🌐 Description

type

🌐 Key

你想要停止监听的事件类型。

🌐 the event type you'd like to stop listening to.

handler

Handler<EventsWithWildcard<Events>[Key]>

(可选) 应该被移除的函数。

🌐 (Optional) the function that should be removed.

返回:

this

this 使你能够串联方法调用。