Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
SimpleEventBus is a global variable for the event stream. See This class provides methods for managing the flow of the events. See the Global Client Events article for more information on about the usage of these methodssystem out-of-the-box events that the class can interact with.
on(eventType, callback)
A subscription Use this method to subscribe to an event.
Parameters:
Name | Type | Mandatory | Default Valuevalue |
---|---|---|---|
eventType | String | Y | N |
callbackcallback | Function | Y | N |
Return:
Type | Description |
---|---|
Object | Contains the unsubscribe methodAn object containing a method to unsubscribe from the event. |
Example:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
const obj = SimpleEventBus.on('myEvent', (data) => { alert(data); }) obj.unsubscribe(); |
emit(eventType, data)
This method starts an event. Use it Use this method in client scripts of the widgetsor widgets to initiate an event.
Parameters:
Name | Type | Mandatory | Default Valuevalue |
---|---|---|---|
eventType | String | Y | N |
data | Any | N | N |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
const obj = SimpleEventBus.emit('myEvent', 'text') |
deleteEvent(eventType)
Deletes Use this method to delete an event.
Parameter:
Name | Type | Mandatory | Default Valuevalue |
---|---|---|---|
eventType | String | Y | N |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
const obj = SimpleEventBus.deleteEvent('myEvent') |
reset()
This method resets all events and subscriptions.
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
SimpleEventBus.reset() |
Table of Contents | ||
---|---|---|
|