EventHandler class

建構函式

EventHandler(Logger)

方法

addEventCallback(EventCallbackFunction, EventType[], string)

新增事件回調到 array

emitEvent(EventType, InteractionType, EventPayload, EventError)

透過呼叫回撥並附有事件訊息來發出事件

removeEventCallback(string)

從回調陣列中移除帶有 id 的回撥

subscribeCrossTab()

聆聽其他分頁/實例的事件

unsubscribeCrossTab()

取消訂閱廣播活動

建構函式詳細資料

EventHandler(Logger)

new EventHandler(logger?: Logger)

參數

logger
Logger

方法詳細資料

addEventCallback(EventCallbackFunction, EventType[], string)

新增事件回調到 array

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()