API/libsapojs/SAPO/Dom/Event

[Elements] are optional

Class SAPO.Dom.Event


class SAPO.Dom.Event
Defined in Dom/Event/0.1/lib.js

Function Summary
DOMElement element (Object ev)
DOMElement findElement (Object ev, String elmTagName, Boolean force)
fire (DOMElement|String element, String eventName, Object memo)
Dispatch an event to element
Boolean isLeftClick (Object ev)
Boolean isMiddleClick (Object ev)
Boolean isRightClick (Object ev)
observe (DOMElement|String element, String eventName, Function callBack)
Attach an event to element
Object pointer (Object ev)
Number pointerX (Object ev)
Number pointerY (Object ev)
stop (Object event)
stops event propagation and bubbling
stopObserving (DOMElement|String element, String eventName, Function callBack)
Remove an event attached to an element

Function Details

function element

DOMElement element(Object ev)
Parameters:
ev - event object
Returns:
the first element on the given event

function findElement

DOMElement findElement(Object ev, String elmTagName, Boolean force)
Parameters:
ev - event object
elmTagName - tag name to find
force - force the return of the wanted type of tag, or false otherwise
Returns:
the first element which matches given tag name or the document element if the wanted tag is not found

function fire

fire(DOMElement|String element, String eventName, Object memo)
Dispatch an event to element
Parameters:
element - element id or element
eventName - event name
memo - metadata for the event

function isLeftClick

Boolean isLeftClick(Object ev)
Parameters:
ev - event object
Returns:
True if there is a left click on the event

function isMiddleClick

Boolean isMiddleClick(Object ev)
Parameters:
ev - event object
Returns:
True if there is a middle click on the event

function isRightClick

Boolean isRightClick(Object ev)
Parameters:
ev - event object
Returns:
True if there is a right click on the event

function observe

observe(DOMElement|String element, String eventName, Function callBack)
Attach an event to element
Parameters:
element - element id or element
eventName - event name
callBack - Receives event object as a parameter. If you're manually firing custom events, check the eventName property of the event object to make sure you're handling the right event.

function pointer

Object pointer(Object ev)
Parameters:
ev - event object
Returns:
an object with the mouse X and Y position

function pointerX

Number pointerX(Object ev)
Parameters:
ev - event object
Returns:
mouse X position

function pointerY

Number pointerY(Object ev)
Parameters:
ev - event object
Returns:
mouse Y position

function stop

stop(Object event)
stops event propagation and bubbling
Parameters:
event - event handle

function stopObserving

stopObserving(DOMElement|String element, String eventName, Function callBack)
Remove an event attached to an element
Parameters:
element - element id or element
eventName - event name
callBack - callback function