webOShelp.net

Get the latest on:webOS Developers' RSS FeedwebOS Facebook page webOS Twitter Feed

Home Resources API Reference Mojo.Event.listen(target, type{string}, handlerFunction, useCapture)

Mojo.Event.listen(target, type{string}, handlerFunction, useCapture)

A wrapper around addEventListener that adds some parameter checking.

Parameter Type Description
target Element Target to observe
type String Type of event to observe
handlerFunction Function Function that is called when the event occurs
useCapture Boolean True causes event to be observed during the capture phase.  Optional.

Example usage:

        // Setup the TruncTextField widget
        var scratchEventDiv = this.controller.get('scratch_event');
        this.controller.setupWidget('scratch_event_field', tfAttrs, this.scratchEvent);
        this.controller.instantiateChildWidgets(scratchEventDiv);
        this.scratchEventField = this.controller.get('scratch_event_field');
        this.scratchEventCommitHandler = this.handleEditScratchEventCommit.bind(this);
        this.scratchEventKeyEventHandler = this.handleScratchEventKey.bind(this);
        this.scratchEventTapHandler = this.handleScratchEventTap.bind(this)
        this.scratchEventHoldHandler = this.handleScratchEventHold.bind(this);
        
        // Listen for the key and tap events on the whole scene when a 
        // scratch event is present
        Mojo.Event.listen(scratchEventDiv, "keyup", this.scratchEventKeyEventHandler);
        Mojo.Event.listen(this.controller.sceneElement, 
             Mojo.Event.tap, this.scratchEventTapHandler);
        Mojo.Event.listen(this.controller.sceneElement, 
             Mojo.Event.hold, this.scratchEventHoldHandler);
 

0 Comments

Add Comment


    • >:o
    • :-[
    • :'(
    • :-(
    • :-D
    • :-*
    • :-)
    • :P
    • :\
    • 8-)
    • ;-)

     

     

    Most Read Articles


    Warning: Creating default object from empty value in /home/weboshelprt/weboshelp.net/modules/mod_mostread/helper.php on line 79

    Warning: Creating default object from empty value in /home/weboshelprt/weboshelp.net/modules/mod_mostread/helper.php on line 79

    Warning: Creating default object from empty value in /home/weboshelprt/weboshelp.net/modules/mod_mostread/helper.php on line 79

    Warning: Creating default object from empty value in /home/weboshelprt/weboshelp.net/modules/mod_mostread/helper.php on line 79

    Warning: Creating default object from empty value in /home/weboshelprt/weboshelp.net/modules/mod_mostread/helper.php on line 79

    Warning: Creating default object from empty value in /home/weboshelprt/weboshelp.net/modules/mod_mostread/helper.php on line 79

    Warning: Creating default object from empty value in /home/weboshelprt/weboshelp.net/modules/mod_mostread/helper.php on line 79

    Warning: Creating default object from empty value in /home/weboshelprt/weboshelp.net/modules/mod_mostread/helper.php on line 79

    Warning: Creating default object from empty value in /home/weboshelprt/weboshelp.net/modules/mod_mostread/helper.php on line 79

    Warning: Creating default object from empty value in /home/weboshelprt/weboshelp.net/modules/mod_mostread/helper.php on line 79