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 | Methods

Constructor

IEventManager()

Methods

Name

Returns

Description

add(types, callback[, context[, priority]])

IEventManager

Adds a new subscription.

fire(type[, event])

IEventManager

Triggers an event.

getParent()

IEventManager|null

Returns reference to the parent event manager.

group()

IEventGroup

Returns the group of event listeners associated with the given event manager.

once(types, callback[, context[, priority]])

IEventManager

Adds a listener, which calls the handler function only one time.

remove(types, callback[, context[, priority]])

IEventManager

Removes an existing subscription.

setParent(parent)

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

types*

—

Type: String|String[]

Type or array of types for the event.

callback*

—

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.

context

—

Type: Object

Context for the handler.

priority

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*

—

Type: String

Type of event.

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

types*

—

Type: String|String[]

Type or array of types for the event.

callback*

—

Type: Function

Handler function for the event. The function is passed an object of the event IEvent.

context

—

Type: Object

Context for the handler.

priority

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

types*

—

Type: String|String[]

Type or array of types for the event.

callback*

—

Type: Function

Handler function for the event. The function is passed an object of the event IEvent.

context

—

Type: Object

Context for the handler.

priority

0

Type: Integer

Subscription priority.

* Mandatory parameter/option.

setParent

{} setParent(parent)

Sets the parent event manager.

Parameters:

Parameter

Default value

Description

parent*

—

Type: IEventManager|null

Parent event manager.

* Mandatory parameter/option.