[Mobile] Detect touch support

This commit is contained in:
Victor Woeltjen
2015-12-29 12:43:46 -08:00
parent 91b42fc0cc
commit 2df61998ab
4 changed files with 14 additions and 0 deletions

View File

@ -46,6 +46,7 @@ define(
this.userAgent = userAgent;
this.mobileName = matches[0];
this.$window = $window;
this.touchEnabled = ($window.ontouchstart !== undefined);
}
/**
@ -92,6 +93,14 @@ define(
return !this.isPortrait();
};
/**
* Check if the user's device supports a touch interface.
* @returns {boolean} true if touch is supported
*/
AgentService.prototype.isTouch = function () {
return this.touchEnabled;
};
/**
* Check if the user agent matches a certain named device,
* as indicated by checking for a case-insensitive substring