Mobile Support - in the Closure Library

I'm just wondering if we have a specific library or framework built on the closing library, specifically designed for touch devices (Android or Ipad). I already have my web application using closure library, now I want to maintain consistency for mobile touch devices or tablets.

There are many other frameworks or plugins for other libraries, such as: http://www.sencha.com/products/touch/ - (Ext.js) http://jqtouch.com/ - (jquery)

Do we have something similar for a closure library. Can someone please help me with this.

+5
source share
2 answers

As far as I know, simple TOUCH events are already defined

/**
* Constants for event names.
* @enum {string}
*/
goog.events.EventType = {
    ...
    // WebKit touch events.
    TOUCHSTART: 'touchstart',
    TOUCHMOVE: 'touchmove',
    TOUCHEND: 'touchend',
    TOUCHCANCEL: 'touchcancel',

}

But there is no gesture recognizer.

If you use Webkit gestures (Safari), you will have to create your own externs file.

https://developer.apple.com/library/iad/documentation/UserExperience/Reference/GestureEventClassReference/index.html#//apple_ref/javascript/cl/GestureEvent

+2
source

If you download the touch library from jQueryMobile. Just create jQueryMobile only with your touch library. Import it into your project. Then you have a map like me ...

  var hasTouch = 'ontouchstart' in window;

  var humanEvents = {

    DOWN: (hasTouch) ? goog.events.EventType.TOUCHSTART : goog.events.EventType.MOUSEDOWN,
    OVER: (hasTouch) ? goog.events.EventType.TOUCHSTART : goog.events.EventType.MOUSEOVER,
    MOVE: (hasTouch) ? goog.events.EventType.TOUCHMOVE : goog.events.EventType.MOUSEMOVE,
    UP: (hasTouch) ? goog.events.EventType.TOUCHEND : goog.events.EventType.MOUSEUP,
    OUT: (hasTouch) ? goog.events.EventType.TOUCHEND : goog.events.EventType.MOUSEOUT,
    CLICK: (hasTouch) ? "tap" : goog.events.EventType.CLICK

  };
+1
source

All Articles