There are numerous cases where a component will be required to not accept any user input and not allow any state changes. These cases include:
User input can be rejected by adding a call to Echo.Client.verifyInput()
to each event listener, and returning immediately if the result is false. The following code snippet shows a hypothetical click listener that uses verifyInput()
:
_processClick: function(e) { if (!this.client.verifyInput(this.component)) { return true; } [ code to actually process click would follow here ] }
Note that in this case, where the events are fired from the CoreJS Core.Web.Event
processor, true
is returned to indicate that the event may bubble to other listeners.
If the event's default action would alter the state of the user interface in and of itself, the case where verifyInput()
evaluates to false
should first invoke Core.Web.DOM.preventEventDefault(e);
to prevent the default behavior from occurring. Likewise, if the state could have changed anyway, code should be added to undo any such state change, e.g., by re-rendering a portion of the component (prevention is obviously far more desirable).