Menu
©2015
Documentation generator: JsDoc Toolkit 2.4.0
Template: Codeview 1.2
Generated on: 2015-1-16 18:32

Class puredom.EventEmitter

Class Summary
Constructor Attributes Constructor Name and Description
 
Creates a new EventEmitter instance.

Method Summary

Method Attributes Method Name and Description
 
emit (type, args)
Fire an event of a given type.
 
on (type, handler)
Register an event listener on the instance.
 
once (type, handler)
A version of .on() that removes handlers once they are called.
 
removeListener (type, handler)
Remove an event listener from the instance.

Class Detail

puredom.EventEmitter()
Creates a new EventEmitter instance.

Method Detail

  • {Array} emit(type, args)
    Fire an event of a given type.
    Pass a comma-separated list for type to fire multiple events at once.
    Parameters:
    {String} type
    Event type, or a comma-seprated list of event types.
    {Array} args Optional
    Arguments to pass to each handler. Non-Array values get auto-boxed into an Array.
    Returns:
    {Array} an Array of handler return values. The Array also has "truthy" and "falsey" properties indicating if any handlers returned true or false, respectively.
  • {this} on(type, handler)
    Register an event listener on the instance.
    Parameters:
    {String} type
    An event type, or a comma-seprated list of event types.
    {Function} handler
    A function to call in response to events of the given type.
    Returns:
    {this}
  • {this} once(type, handler)
    A version of .on() that removes handlers once they are called.
    Parameters:
    {String} type
    An event type, or a comma-seprated list of event types.
    {Function} handler
    A function to call in response to events of the given type. Will only be called once.
    Returns:
    {this}
    See:
    puredom.EventEmitter#on
  • {this} removeListener(type, handler)
    Remove an event listener from the instance.
    Parameters:
    {String} type
    An event type, or a comma-seprated list of event types.
    {Function} handler
    A reference to the handler, as was originally passed to {puredom.EventEmitter#addEventListener}.
    Returns:
    {this}