跳到主要內容
版本:23.11.1

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 讓您可以鏈式調用方法。