This function can be used to listen for changes in which element has focus inside the specified node.
A listener object is returned which implements a stopListening() method. This can be called tp permanently cancel the listener, removing its event listeners.
Parameter | Type | Description |
---|---|---|
node | Node on which to listen for events | |
handler | Function | Function called when focus changes. Passes the newly focused element or null. |
Example usage:
this.controller.setupWidget('emailAddress', this.emailAttributes, this.emailModel); $('emailAddress').observe(Mojo.Event.propertyChange, this.emailChanged.bind(this)); this.emailFocusHandler = this.emailHandler.bind(this); Mojo.Event.listenForFocusChanges($('emailAddress'), this.emailFocusHandler);
0 Comments