dojo/on: New Event Handling System for Dojo
| tags: javascript, links
Nice event handling in Dojo 1.7
Dojo 1.7 includes a rewrite of the event handling system and introduces a new module,
dojo/on
, to provide lighter-weight, faster, more succinct, and more direct event handling. The new event system is highly optimized for mobile applications, with a lightweight footprint and cross-platform touch event normalization. While Dojo continues to provide backwards compatibility withdojo.connect
, thedojo/on
module eliminates much of code that is rarely used indojo.connect
and can be loaded in 5.2KB minified, half the size ofdojo.connect
, and fires non-native events twice as fast. Thedojo/on
module also includes new functionality for extension events, dispatching events, and providing a base class/mixin for adding event emitting functionality to classes. In addition, there is now a newon()
method forNodeLists
(the results ofdojo.query()
) based on the new event listening with event delegation.