EventHandler class

构造函数

EventHandler(Logger)

方法

addEventCallback(EventCallbackFunction, EventType[], string)

将事件回调添加到数组

emitEvent(EventType, InteractionType, EventPayload, EventError)

通过调用包含事件消息的回调来发出事件

removeEventCallback(string)

从回调数组中删除具有提供的 ID 的回调

subscribeCrossTab()

侦听从其他选项卡/实例广播的事件

unsubscribeCrossTab()

取消订阅广播事件

构造函数详细信息

EventHandler(Logger)

new EventHandler(logger?: Logger)

参数

logger
Logger

方法详细信息

addEventCallback(EventCallbackFunction, EventType[], string)

将事件回调添加到数组

function addEventCallback(callback: EventCallbackFunction, eventTypes?: EventType[], callbackId?: string): null | string

参数

callback
EventCallbackFunction

引发事件时要调用的回调

eventTypes

EventType[]

将为其调用此回调的事件列表,如果未提供回调,则会为所有事件调用

callbackId

string

回调的标识符,用于在不再需要时查找和删除回调

返回

null | string

emitEvent(EventType, InteractionType, EventPayload, EventError)

通过调用包含事件消息的回调来发出事件

function emitEvent(eventType: EventType, interactionType?: InteractionType, payload?: EventPayload, error?: EventError)

参数

eventType
EventType
interactionType
InteractionType
payload
EventPayload
error
EventError

removeEventCallback(string)

从回调数组中删除具有提供的 ID 的回调

function removeEventCallback(callbackId: string)

参数

callbackId

string

subscribeCrossTab()

侦听从其他选项卡/实例广播的事件

function subscribeCrossTab()

unsubscribeCrossTab()

取消订阅广播事件

function unsubscribeCrossTab()