dojo/on: New Event Handling System for Dojo

| tags: javascript, links

Nice event handling in Dojo 1.7

SitePen Blog

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 with dojo.connect, the dojo/on module eliminates much of code that is rarely used in dojo.connect and can be loaded in 5.2KB minified, half the size of dojo.connect, and fires non-native events twice as fast. The dojo/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 new on() method for NodeLists (the results of dojo.query()) based on the new event listening with event delegation.