Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizable sequence timeout #472

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions mousetrap.js
Expand Up @@ -477,6 +477,13 @@
*/
var _resetTimer;

/**
* amount of time (ms) to wait before resetting the sequence
*
* @type {number}
*/
self.resetSequenceTimeout = 1000;

/**
* temporary state where we will ignore the next keyup
*
Expand Down Expand Up @@ -738,16 +745,17 @@
}

/**
* called to set a 1 second timeout on the specified sequence
* called to set a timeout on the specified sequence
*
* this is so after each key press in the sequence you have 1 second
* this is so after each key press in the sequence you have
* some amount of time (1 second by default)
* to press the next key before you have to start over
*
* @returns void
*/
function _resetSequenceTimer() {
clearTimeout(_resetTimer);
_resetTimer = setTimeout(_resetSequences, 1000);
_resetTimer = setTimeout(_resetSequences, self.resetSequenceTimeout);
}

/**
Expand Down