Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #334 from ftlabs/guardian
Browse files Browse the repository at this point in the history
Add timeout to tap [mergeable PR]
  • Loading branch information
matthew-andrews committed Nov 25, 2014
2 parents 5ac8bbb + 71276f0 commit 807c73a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/fastclick.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@
*/
this.tapDelay = options.tapDelay || 200;

/**
* The maximum time for a tap
*
* @type number
*/
this.tapTimeout = options.tapTimeout || 700;

if (FastClick.notNeeded(layer)) {
return;
}
Expand Down Expand Up @@ -524,6 +531,10 @@
return true;
}

if ((event.timeStamp - this.trackingClickStart) > this.tapTimeout) {
return true;
}

// Reset to prevent wrong click cancel on input (issue #156).
this.cancelNextClick = false;

Expand Down

0 comments on commit 807c73a

Please sign in to comment.