diff options
author | Andrew Dolgov <[email protected]> | 2012-08-14 18:59:10 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-08-14 18:59:18 +0400 |
commit | 1354d17270961fff662d40f90521223f8fd0d73b (patch) | |
tree | e9266be71587e47c800303446e968a6d3565e2cf /lib/dojo/touch.js.uncompressed.js | |
parent | d04f8c826f5283765f52cf6b98b42a1ed8f2d6bc (diff) |
update dojo to 1.7.3
Diffstat (limited to 'lib/dojo/touch.js.uncompressed.js')
-rw-r--r-- | lib/dojo/touch.js.uncompressed.js | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/lib/dojo/touch.js.uncompressed.js b/lib/dojo/touch.js.uncompressed.js new file mode 100644 index 000000000..2b3cf5b10 --- /dev/null +++ b/lib/dojo/touch.js.uncompressed.js @@ -0,0 +1,89 @@ +define("dojo/touch", ["./_base/kernel", "./on", "./has", "./mouse"], function(dojo, on, has, mouse){ +// module: +// dojo/touch + +/*===== + dojo.touch = { + // summary: + // This module provides unified touch event handlers by exporting + // press, move, release and cancel which can also run well on desktop. + // Based on http://dvcs.w3.org/hg/webevents/raw-file/tip/touchevents.html + // + // example: + // 1. Used with dojo.connect() + // | dojo.connect(node, dojo.touch.press, function(e){}); + // | dojo.connect(node, dojo.touch.move, function(e){}); + // | dojo.connect(node, dojo.touch.release, function(e){}); + // | dojo.connect(node, dojo.touch.cancel, function(e){}); + // + // 2. Used with dojo.on + // | define(["dojo/on", "dojo/touch"], function(on, touch){ + // | on(node, touch.press, function(e){}); + // | on(node, touch.move, function(e){}); + // | on(node, touch.release, function(e){}); + // | on(node, touch.cancel, function(e){}); + // + // 3. Used with dojo.touch.* directly + // | dojo.touch.press(node, function(e){}); + // | dojo.touch.move(node, function(e){}); + // | dojo.touch.release(node, function(e){}); + // | dojo.touch.cancel(node, function(e){}); + + press: function(node, listener){ + // summary: + // Register a listener to 'touchstart'|'mousedown' for the given node + // node: Dom + // Target node to listen to + // listener: Function + // Callback function + // returns: + // A handle which will be used to remove the listener by handle.remove() + }, + move: function(node, listener){ + // summary: + // Register a listener to 'touchmove'|'mousemove' for the given node + // node: Dom + // Target node to listen to + // listener: Function + // Callback function + // returns: + // A handle which will be used to remove the listener by handle.remove() + }, + release: function(node, listener){ + // summary: + // Register a listener to 'touchend'|'mouseup' for the given node + // node: Dom + // Target node to listen to + // listener: Function + // Callback function + // returns: + // A handle which will be used to remove the listener by handle.remove() + }, + cancel: function(node, listener){ + // summary: + // Register a listener to 'touchcancel'|'mouseleave' for the given node + // node: Dom + // Target node to listen to + // listener: Function + // Callback function + // returns: + // A handle which will be used to remove the listener by handle.remove() + } + }; +=====*/ + + function _handle(/*String - press | move | release | cancel*/type){ + return function(node, listener){//called by on(), see dojo.on + return on(node, type, listener); + }; + } + var touch = has("touch"); + //device neutral events - dojo.touch.press|move|release|cancel + dojo.touch = { + press: _handle(touch ? "touchstart": "mousedown"), + move: _handle(touch ? "touchmove": "mousemove"), + release: _handle(touch ? "touchend": "mouseup"), + cancel: touch ? _handle("touchcancel") : mouse.leave + }; + return dojo.touch; +});
\ No newline at end of file |