IEventManager
Extends IEventTrigger.
Event manager. Using an event manager, you can subscribe to and unsubscribe from events, as well as initiate the events themselves.
Constructor
IEventManager()
Methods
Name |
Returns |
Description |
Adds a new subscription. |
||
Triggers an event. |
||
IEventManager|null |
Returns reference to the parent event manager. |
|
group() |
Returns the group of event listeners associated with the given event manager. |
|
Adds a listener, which calls the handler function only one time. |
||
Removes an existing subscription. |
||
Sets the parent event manager. |
Methods details
add
{IEventManager} add(types, callback[, context[, priority]])
Adds a new subscription.
Returns self-reference.
Parameters:
Parameter |
Default value |
Description |
— |
Type: String|String[] Type or array of types for the event. |
|
— |
Type: Function Handler function for the event. An object describing the event is passed to the function as a parameter. It can be either an arbitrary object, or implement the interface IEvent. |
|
— |
Type: Object Context for the handler. |
|
0 |
Type: Integer Subscription priority. |
* Mandatory parameter/option.
fire
{IEventManager} fire(type[, event])
Triggers an event.
Returns self-reference.
Parameters:
Parameter |
Default value |
Description |
|
— |
Type: String Type of event. |
— |
Type: Object|Event Event. If a hash with data is passed, the createEventObject method will be called for it and further actions will be performed with the newly created event. |
* Mandatory parameter/option.
getParent
{IEventManager|null} getParent()
Returns reference to the parent event manager.
group
{IEventGroup} group()
Returns the group of event listeners associated with the given event manager.
once
{IEventManager} once(types, callback[, context[, priority]])
Adds a listener, which calls the handler function only one time.
Returns self-reference.
Parameters:
Parameter |
Default value |
Description |
— |
Type: String|String[] Type or array of types for the event. |
|
— |
Type: Function Handler function for the event. The function is passed an object of the event IEvent. |
|
— |
Type: Object Context for the handler. |
|
0 |
Type: Integer Subscription priority. |
* Mandatory parameter/option.
remove
{IEventManager} remove(types, callback[, context[, priority]])
Removes an existing subscription.
Returns self-reference.
Parameters:
Parameter |
Default value |
Description |
— |
Type: String|String[] Type or array of types for the event. |
|
— |
Type: Function Handler function for the event. The function is passed an object of the event IEvent. |
|
— |
Type: Object Context for the handler. |
|
0 |
Type: Integer Subscription priority. |
* Mandatory parameter/option.
setParent
{} setParent(parent)
Sets the parent event manager.
Parameters:
Parameter |
Default value |
Description |
— |
Type: IEventManager|null Parent event manager. |
* Mandatory parameter/option.
Mandatory parameter/option.