API Reference 0.3.24dart_web_toolkit_eventTouchSupportDetector

TouchSupportDetector class

Dectector for browser support for touch events.

class TouchSupportDetector {

 bool _isSupported;

 bool isSupported() {
   return _isSupported;
 }

 TouchSupportDetector() {
   _isSupported = detectTouchSupport();
 }
 
 bool detectTouchSupport() {
   dart_html.DivElement elem = new dart_html.DivElement();
   try {
     elem.onTouchStart.listen((dart_html.Event evt){
       return;
     });
   } on Exception catch(e) {
     return false;
   }
   return true;
 }
}

Subclasses

TouchSupportDetectorNo

Constructors

new TouchSupportDetector() #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
TouchSupportDetector() {
 _isSupported = detectTouchSupport();
}

Methods

bool detectTouchSupport() #

bool detectTouchSupport() {
 dart_html.DivElement elem = new dart_html.DivElement();
 try {
   elem.onTouchStart.listen((dart_html.Event evt){
     return;
   });
 } on Exception catch(e) {
   return false;
 }
 return true;
}

bool isSupported() #

bool isSupported() {
 return _isSupported;
}