3 | | * Uses has() branching |
4 | | * Function event types, allowing you to create new custom/extension events (like dojo/touch.press) in a safe extensible way. Special handling of certain key events (keypress, onmouseleave, and onmousenter) are implemented using extension events. For example |
5 | | {{{dojo.connect(node, dojo.touch.press, listener);}}} |
6 | | * Introduce a new lightweight dojo/listen module/function that can be used sans the large blocks of corrective code for keypress, onmouseleave, and onmousenter emulation (particular useful to avoid for mobile apps). |
7 | | * Modularization - Trying to improve the modularity of our event handling: There is several distinct pieces of functionality in dojo/_base/event.js that is broken out: |
8 | | - keypress handling - this is moved out to dojo/_base/keypress.js as a custom extension/emulation event. |
9 | | - mouseenter/mouseleave handling - moved to dojo/mouse.js as a custom extension/emulation event. |
10 | | - aop - Used for listening to regular object's methods, can be used on its own, but leveraged by listen module (dojo/aop) |
| 3 | * Uses `has()` branching |
| 4 | * Function event types, allowing you to create new custom/extension events (like `dojo/touch.press`) in a safe extensible way. Special handling of certain key events (`keypress`, `onmouseleave`, and `onmousenter`) are implemented using extension events. For example: |
| 5 | {{{ |
| 6 | #!js |
| 7 | dojo.connect(node, dojo.touch.press, listener); |
| 8 | }}} |
| 9 | * Introduce a new lightweight `dojo/listen` module/function that can be used sans the large blocks of corrective code for `keypress`, `onmouseleave`, and `onmousenter` emulation (particular useful to avoid for mobile apps). |
| 10 | * Modularization - Trying to improve the modularity of our event handling: There is several distinct pieces of functionality in `dojo/_base/event.js` that is broken out: |
| 11 | - `keypress` handling - this is moved out to `dojo/_base/keypress.js` as a custom extension/emulation event. |
| 12 | - `mouseenter`/`mouseleave` handling - moved to `dojo/mouse.js` as a custom extension/emulation event. |
| 13 | - aop - Used for listening to regular object's methods, can be used on its own, but leveraged by listen module (`dojo/aop`) |
15 | | * NodeList.prototype.on() maps to listen() function - |
16 | | {{{dojo.query(".class").on("some-event", callback);}}} |
17 | | * Return value from connect() and listen()/on() is an object with three methods: cancel(), pause(), and resume() dojo.disconnect(handle) still works, but can do handle.cancel() instead (as well as pause and resume) |
18 | | * dojo/listen provides an Evented base class that can be extended for event emitting objects, providing on() and emit() methods (could be used by a future widget class hierarchy) |
| 18 | * `NodeList.prototype.on()` maps to `listen()` function - |
| 19 | {{{ |
| 20 | #!js |
| 21 | dojo.query(".class").on("some-event", callback); |
| 22 | }}} |
| 23 | * Return value from `connect()` and `listen()`/`on()` is an object with three methods: `cancel()`, `pause()`, and `resume()` `dojo.disconnect(handle)` still works, but can do `handle.cancel()` instead (as well as pause and resume) |
| 24 | * `dojo/listen` provides an Evented base class that can be extended for event emitting objects, providing `on()` and `emit()` methods (could be used by a future widget class hierarchy) |