API Docs for: 0.13.12
Show:

Events Class

Defined in: src\firebrick.js:1515
Module: Firebrick

Methods

_addListener

(
  • object
)
private

Use Firebrick.events:addListeners

Parameters:

  • object Object

Example:

 addListeners_internal({
               "myEvent": function(){},
               "mySecondEvent": function(){},
               scope: this
           })

_initEventObject

(
  • name
)
Object private

this object is passed to all fireEvent listeners

Parameters:

  • name String

    event name

Returns:

Object:

_on

(
  • object
)
private

use Firebrick.events:on

Parameters:

  • object Object

Example:

    _on({
                       "a.link":{
                           click:function(){},
                           mouseover:function(){}
                       },
                       "a, button": {
                           click: function(){}
                       }
                       scope:this
                   }

_registerOnEvent

() private

use Firebrick.events:on

addListener

(
  • eventName
  • callback
  • scope
)
Function

add a listener to a specific event by name

Parameters:

  • eventName String, Object
  • callback Function
  • scope Object

    (optional) scope in which the listener is fired in

Returns:

Function:

the function with the assigned callbackId;

Example:

    addListener("myEvent", myFunction(){}, this);
    addListener({
                   "myEvent": function(){},
                   "event1, event2": function(){},
                   "mySecondEvent": function(){},
                   scope: this
               })

(
  • selector
  • eventName
  • callback
)

Makes use of the jQuery .off() function

Parameters:

  • selector String
  • eventName String
  • callback Function

    the function used in on()

Example:

    off( "click", "#theone", function(){} )

createEventData

(
  • eventName
)
Object private

creates the event object to be passed as argument when event is fired

Parameters:

  • eventName String

Returns:

Object:

event object

fireEvent

(
  • eventName
  • arguments
)

Fire an event by name

Parameters:

  • eventName String
  • arguments Any...

    arguments passed to event when fired

Example:

    fireEvent("eventToFire", 1, "test", false);

on

(
  • eventName
  • selector
  • callback
  • scope
)

Define events and their callbacks, similar to $(selector).on(eventname, callback)

Parameters:

  • eventName String, Object

    string = same as jquery selector(s)

  • selector String

    (optional) use if first arg is not an object

  • callback Function

    (optional) use if first arg is not an object

  • scope Object

    (optional) change scope on callback function use if first arg is not an object

Example:

    on("click", "a.mylink", function(){}, newScope)
    on({
                   "a.link":{
                       click:function(){},
                       mouseover:function(){}
                   },
                   "a, button":{
                       click: function(){}
                   }
                   scope:this
               })

removeListener

(
  • eventName
  • funct
)

remove listener by eventName and function

Parameters:

  • eventName String
  • funct Function

    (optional) if non given will remove all listeners for event

Example:

    removeListener("myEvent", function);

removeSelf event.removeSelf();

()

removes the listener it called from within

Example:

Properties

eventRegistry

Object map private

Event registry