Events Class
Item Index
Methods
Properties
Methods
_addListener
-
object
Use Firebrick.events:addListeners
Parameters:
-
object
Object
Example:
addListeners_internal({
"myEvent": function(){},
"mySecondEvent": function(){},
scope: this
})
_initEventObject
-
name
this object is passed to all fireEvent listeners
Parameters:
-
name
Stringevent name
Returns:
_on
-
object
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
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:
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
Functionthe function used in on()
Example:
off( "click", "#theone", function(){} )
createEventData
-
eventName
creates the event object to be passed as argument when event is fired
Parameters:
-
eventName
String
Returns:
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, Objectstring = 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