API Docs for: 7.2
Show:

MQA.EventManager Class

Module: MQA

Manages event listeners and event handling.

Methods

addListener

(
  • source
  • eventType
  • handler
  • [target]
)
String

Register an event handler for a custom event on the source object.

Parameters:

  • source Object

    The object emitting events to handler.

  • eventType String

    Name of event handler should listen to.

  • handler Function

    A function to call when the event triggers.

  • [target] Object optional

    Context object to be handler function's this. Defaults to source.

Returns <String>

the passed in handler

clearAllListeners

(
  • source
)

Removes all listeners on source

Parameters:

clearListeners

(
  • source
  • eventType
)

Removes all handlers on the given object for the given event that were installed using addListener(). If event is not specified, removes all handlers on the given object for all events that were installed using addListener().

Parameters:

  • source Object

    The object to remove the listeners from

  • eventType String

    The name of the event to clear.

eventMap

(
  • source
)
Object private

Return an event map for the given source object. Creates as necessary

Parameters:

Returns <Object>

event map of event name => array of listener functions

removeListener

(
  • source
  • eventType
  • handler
  • [target]
)

Remove event handler installed via addListener().

Parameters:

  • source Object

    The object emitting events for handler.

  • eventType String

    Event name handler is listening to.

  • handler Function

    The event listener to remove.

  • [target] Object optional

    Context object handler was registered with. Defaults to source. N.B.: If target !== addListener()'s target, handler will not be removed.

Returns

passed in handler

trigger

(
  • source
  • eventType
  • event
)

Fires a custom event on the source object. All arguments after event param are passed as arguments to the event handler functions.

Parameters: