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. 

Parameters:

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.

Parameters:

NameTypeMandatoryDefault value
eventTypeStringYN
dataAnyNN

Return:

TypeDescription
VoidThis method does not return a value.

Example:

emit()
const obj = SimpleEventBus.emit('myEvent', 'text')

deleteEvent(eventType)


Use this method to delete an event.

Parameter:

NameTypeMandatoryDefault value
eventTypeStringYN

Return:

TypeDescription
VoidThis method does not return a value.

Example:

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

reset()


This method resets all events and subscriptions.

Return:

TypeDescription
VoidThis method does not return a value.

Example:

reset()
SimpleEventBus.reset()

  • No labels