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