Skip to content

Instantly share code, notes, and snippets.

@abulte
Last active January 2, 2016 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abulte/8357438 to your computer and use it in GitHub Desktop.
Save abulte/8357438 to your computer and use it in GitHub Desktop.
Test fast click efficiency on mobile
module.directive('mesureTime', function() {
return {
restrict: 'A',
// require: 'ngModel',
link: function(scope, elm, attrs, ctrl) {
var timeTouch;
elm.on('click', function() {
if (timeTouch) {
alert(new Date().getTime() - timeTouch, " ms");
} else {
alert("timetouch is undefined");
}
return false;
}).on('touchend', function() {
timeTouch = new Date().getTime();
});
}
};
});
<div mesure-time class="topcoat-button center full">Mesurer</div>

Results

  • w/ fastclick, w/o angular-touch : 355-365ms
  • w/o fastclick, w/o angular-touch : idem
  • w/o fastclick, w/ angular-touch : idem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment