Skip to main content
Version: 1.22.3

SimpleEventBus

This class provides methods for managing the flow of the events. See the Global Client Events article for more information about the system out-of-the-box events that the class can interact with.

on(eventType, callback)


Use this method to subscribe to an event.

Parameter(s):

NameTypeMandatoryDefault value
eventTypeStringYN
callbackFunctionYN

Return:

TypeDescription
ObjectAn object containing a method to unsubscribe from the event.

Example:

on()
const obj = SimpleEventBus.on('myEvent', (data) => { alert(data); })
obj.unsubscribe();

emit(eventType, data)


Use this method in client scripts or widgets to initiate an event.

Parameter(s):

NameTypeMandatoryDefault value
eventTypeStringYN
dataAnyNN

Return:

TypeDescription
VoidThis method does not return a value.

Example:

emit()
SimpleEventBus.emit('myEvent', 'text')

deleteEvent(eventType)


Use this method to delete an event.

Parameter(s):

NameTypeMandatoryDefault value
eventTypeStringYN

Return:

TypeDescription
VoidThis method does not return a value.

Example:

deleteEvent()
const obj = SimpleEventBus.deleteEvent('myEvent')

reset()


Use this method to reset all events and subscriptions.

Return:

TypeDescription
VoidThis method does not return a value.

Example:

reset()
SimpleEventBus.reset()