- Project owner
Evan Huang
- since
v1.7
dojo/touch is a module that provides a set of events designed to work similarly on a desktop browser (e.g. with mouse) and touch devices, so that the developer only needs to handle code for one set of events and abstract themselves from the specifics of mouse and touch events.
Requiring in the module makes the events available for handling:
There are two main ways of using dojo/touch
. The first is using it coupled with dojo/on <dojo/on>
. For example:
Also, the touch event listeners can be registered directly with the module:
The following table provides information on the events supported by the module:
dojo/touch Event | Browser | Touch Device | Notes |
---|---|---|---|
press release over out enter leave |
mousedown mouseup mouseover mouseout |
touchstart touchend synthetic synthetic synthetic synthetic |
|
move cancel |
mousemove mouseleave |
synthetic touchcancel |
This synthetic events fires on the node that the finger is currently over, rather than the node where the drag started. |
dojox/gesture <dojox/gesture>
extends dojo/touch
.
If a device has both mouse and touch (like Blackberry phones or some high end desktop computers), dojo/touch
will only monitor touch events; ideally it should be monitoring both.
Please see #13048. This will not be addressed until Dojo 2.0.
- W3C Touch Events Specification
dojo/mouse <dojo/mouse>
- Moused based eventsdojox/gesture <dojox/gesture>
- Gesture based events