Events
The World Wide Web Consortium (W3C) HTML event model provides a way to respond to user actions. In the model, which is part of the HTML DOM, user actions can be associated with a DOM element. When an action occurs on the DOM element, the browser generates an event and invokes the JavaScript code subscribed to the element, for a particular event type. The W3C HTML event model defines standard event types, such as load, mouseover, click, and resize, corresponding to user actions.
The framework implements an event model very similar to the W3C HTML event model. One difference is that the framework defines event types at a higher level of abstraction, representing actions meaningful to the UI model and framework widgets.
Framework Event Types
Mojo defines unique event types supporting different parts of the UI system:
System UI events, such as drag, flick, and hold
Widget events, including
listTap,propertyChange, and moreApplication UI events, such as
scrollStarting,stageActivate, andstageDeactivate
You should refer to the API documentation, specifically Mojo.Event, for a complete list with descriptions and references to the event object properties and related information. For the System and Application UI event types, the meaning of the event depends on the context in which the event occurs, and you need to handle the event accordingly.
The framework also provides a way to define custom events and
propagate events to an event handler through Mojo.Event.make and
Mojo.Event.send
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access