]> git.wh0rd.org - tt-rss.git/blobdiff - lib/dojo/touch.js.uncompressed.js
update dojo to 1.7.3
[tt-rss.git] / lib / dojo / touch.js.uncompressed.js
diff --git a/lib/dojo/touch.js.uncompressed.js b/lib/dojo/touch.js.uncompressed.js
new file mode 100644 (file)
index 0000000..2b3cf5b
--- /dev/null
@@ -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