new Events()
- Source
Methods
cleanEvents(eventName)
removes all the subscriptions with a given event name.
Parameters:
| Name | Type | Description |
|---|---|---|
eventName | string | Optional Name of the event |
- Source
off(eventName, callbackopt) → {boolean}
Removes the subscriptions with a given event name.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
eventName | string | Name of the event. | |
callback | function | <optional> | Optional Function to be removed from the event's callbacks |
- Source
Returns:
- True if the callback was removed, false if it was not found
- Type:
- boolean
on(eventName, callback)
Subscribes to controller resource with a given event name
Parameters:
| Name | Type | Description |
|---|---|---|
eventName | string | Name of the event |
callback | function | Function to be called when event is triggered |
- Source
once(eventName, callback) → {boolean}
Subscribe to an event, but the callback is called only once
Parameters:
| Name | Type | Description |
|---|---|---|
eventName | string | Name of the triggering event |
callback | function | Function to be called when the event is triggered |
- Source
Returns:
- True if the callback was added, false if it was already added
- Type:
- boolean
trigger(eventName, data)
Triggers all the callback functions that have subscribed to an event.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
eventName | string | Name of the event to be triggered | |
data | any | null | Data passed to the callback as input parameter |
- Source