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.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.tap, this.scratchEventTapHandler);
             Mojo.Event.hold, this.scratchEventHoldHandler);


Add Comment

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