new module:br-util /Event Utility()
Methods
(static) add Event Listener(oTarget Elem, sEvent, fEvent Listener, bDirect Attached Event)
Registers the specified event function to a particular event using the provided DOM element.
Parameters:
Name | Type | Description |
---|---|---|
oTargetElem |
Object | The document element the event will be registered against. |
sEvent |
String | The name of the event that will be registered (e.g. 'click', but not 'onclick'). |
fEventListener |
function | The function that will be called when the event fires. |
bDirectAttachedEvent |
boolean | Whether the simpler form of event registration (e.g. |
Returns:
An event listener id to be used in the method (@link #removeEventListenerById) to remove the newly added event listener or NULL if the event listener could not be added for any reason.
(static) prevent Default(oEvent)
Allows the user to prevent the default event, with the use return Utility.preventEventDefault(oEvent);
Parameters:
Name | Type | Description |
---|---|---|
oEvent |
Event | Event passed to your event handler. Note that event handlers are not wrapped
so you need to do something like |
Returns:
Always returns false
(static) remove Event Listener(nUnique Listener Id)
Removes the DOM event listener that has previously been added via the #addEventListener
method.
Parameters:
Name | Type | Description |
---|---|---|
nUniqueListenerId |
int | The event Listener Id that was returned by the method |
(static) stop Propagation(oEvent)
Stops the propagation of an event.
This method should be used within an event listener to prevent bubbling of an event up to other event listeners.
Parameters:
Name | Type | Description |
---|---|---|
oEvent |
Event | Event passed to your event handler. Note that event handlers are not wrapped
so you need to do something like |