EventHandler class
Constructors
Event |
Methods
add |
Adds event callbacks to array |
emit |
Emits events by calling callback with event message |
remove |
Removes callback with provided id from callback array |
subscribe |
Listen for events broadcasted from other tabs/instances |
unsubscribe |
Unsubscribe from broadcast events |
Constructor Details
EventHandler(Logger)
Method Details
addEventCallback(EventCallbackFunction, EventType[], string)
Adds event callbacks to array
function addEventCallback(callback: EventCallbackFunction, eventTypes?: EventType[], callbackId?: string): null | string
Parameters
- callback
- EventCallbackFunction
callback to be invoked when an event is raised
- eventTypes
-
EventType[]
list of events that this callback will be invoked for, if not provided callback will be invoked for all events
- callbackId
-
string
Identifier for the callback, used to locate and remove the callback when no longer required
Returns
null | string
emitEvent(EventType, InteractionType, EventPayload, EventError)
Emits events by calling callback with event message
function emitEvent(eventType: EventType, interactionType?: InteractionType, payload?: EventPayload, error?: EventError)
Parameters
- eventType
-
EventType
- interactionType
- InteractionType
- payload
- EventPayload
- error
- EventError
removeEventCallback(string)
Removes callback with provided id from callback array
function removeEventCallback(callbackId: string)
Parameters
- callbackId
-
string
subscribeCrossTab()
Listen for events broadcasted from other tabs/instances
function subscribeCrossTab()
unsubscribeCrossTab()
Unsubscribe from broadcast events
function unsubscribeCrossTab()