API Docs for: 0.1.8
Show:

EventDispatcher Class

A base class for adding and removing event listeners and dispatching events.

Constructor

EventDispatcher

()

Methods

addEventListener

(
  • type
  • listener
)

Adds an event listener.

Parameters:

  • type String
    • The event type.
  • listener Function
    • The event listener.

apply

(
  • object
)

Extends an object with the event dispatcher functionality.

Parameters:

  • object Object
    • The object.

Example:

EventDispatcher.prototype.apply(X.prototype);

dispatchEvent

(
  • event
)

Dispatches an event to all respective listeners.

Parameters:

  • event Object
    • The event.

hasEventListener

(
  • type
  • listener
)

Checks if the event listener exists.

Parameters:

  • type String
    • The event type.
  • listener Function
    • The event listener.

removeEventListener

(
  • type
  • listener
)

Removes an event listener.

Parameters:

  • type String
    • The event type.
  • listener Function
    • The event listener.

Properties

_listeners

Object private

A map of listeners.