Caplin Trader 5.1.0

Class: module:br-util/EventUtility

module:br-util/EventUtility()

new module:br-util/EventUtility()

Methods

(static) addEventListener(oTargetElem, sEvent, fEventListener, bDirectAttachedEvent)

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. elem.onclick) should be used (false by default). This is still occasionally useful in IE when you want access to the target element and that is different to window.event.srcElement.

See:
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) preventDefault(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 oEvent = oEvent || window.event;

Returns:

Always returns false

(static) removeEventListener(nUniqueListenerId)

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 #addEventListener.

(static) stopPropagation(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 oEvent = oEvent || window.event;