Fires event with given name
, given scope and other parameters.
Arguments
.
) or slash (/
) separatedReturns: object array of returned values from the listeners
Internal method which gives you array of all event handlers that will be triggered by the given name
.
Arguments
.
) or slash (/
) separatedReturns: array array of event handlers
Could be used inside event handler to figure out actual name of the event.
Arguments
Returns: string name of the event, if subname
is not specified
or
Returns: boolean true
, if current event’s name contains subname
Removes given function from the list of event listeners assigned to given name. If no arguments specified all the events will be cleared.
Arguments
.
) or slash (/
) separated, with optional wildcardsBinds given event handler with a given name. You can use wildcards “*
” for the names:
eve.on("*.under.*", f);
eve("mouse.under.floor"); // triggers f
Use eve to trigger the listener.
Arguments
.
) or slash (/
) separated, with optional wildcardsReturns: function returned function accepts a single numeric parameter that represents z-index of the handler. It is an optional feature and only used when you need to ensure that some subset of handlers will be invoked in a given order, despite of the order of assignment.
Example:
eve.on("mouse", eatIt)(2);
eve.on("mouse", scream);
eve.on("mouse", catchIt)(1);
This will ensure that catchIt()
function will be called before eatIt()
.
If you want to put your handler before non-indexed handlers, specify a negative value. Note: I assume most of the time you don’t need to worry about z-index, but it’s nice to have this feature “just in case”.
Binds given event handler with a given name to only run once then unbind itself.
eve.once("login", f);
eve("login"); // triggers f
eve("login"); // no listeners
Use eve to trigger the listener.
Arguments
.
) or slash (/
) separated, with optional wildcardsReturns: function same return function as eve.on
Is used inside an event handler to stop the event, preventing any subsequent listeners from firing.
See eve.off
Current version of the library.