Event Listener module
- Source:
Methods
-
(static) add(event, callback)
-
Adds an event that returns a callback when triggered on the selected event and selector
Parameters:
Name Type Description event
string callback
function - Source:
Example
Eg. $_("#selector").event.add("click", do_something());
-
(static) create(name, dataopt) → {Object}
-
Create a custom event
Parameters:
Name Type Attributes Description name
string data
object <optional>
- Source:
Returns:
- Type
- Object
Example
Eg. var event = $_("#selector").event.create('foo', {});
-
(static) delegate(target, event, callback)
-
Binds an event to a parent object
Parameters:
Name Type Description target
string event
string callback
function - Source:
Example
Eg. $_("#parent").delegate(".button", "click", do_something());
-
(static) live(target, event, callback)
-
Binds a persistent event to the document
Parameters:
Name Type Description target
string event
string callback
function - Source:
Example
Eg. $_.event.live(".button", "click", do_something());
-
(static) remove(event, callback)
-
Removes an event bound the the specified selector, event type, and callback
Parameters:
Name Type Description event
string callback
string - Source:
Example
Eg. $_("#selector").event.remove("click", do_something());
-
(static) trigger(event) → {boolean}
-
Trigger an event to fire
Parameters:
Name Type Description event
object - Source:
Returns:
- Type
- boolean
Example
Eg. $_("#my_id").trigger('click');