Open tifDev opened 5 years ago
Yup! Check out https://github.com/dmauro/Keypress/blob/development/keypress.coffee#L95, it's a little hidden but sequence_delay
is a public property on the keypress.Listener
which you can set (it's milliseconds).
It has no effect... i changed to 2000 miliseconds but i still need to type very fast for the combo to get count. See my small fiddle: https://jsfiddle.net/ombjs132/5/
The code:
var listener = new window.keypress.Listener();
listener.sequence_delay = 2000;
var my_scope = this;
var my_combos = listener.register_many([
{
"keys" : "r c g",
"is_exclusive" : true,
"on_keyup" : function(event) {
console.log("You pressed r c g.");
return true
}
},
{
"keys" : "r c",
"is_exclusive" : true,
"on_keyup" : function(event) {
console.log("You pressed r c.");
return true
}
}
]);
I don't know what changed, but I found sequence_delay
in the g
property of the listener, so my code (which works) looks like this:
if ('g' in keyListener && 'sequence_delay' in (keyListener as any)!.g) {
(keyListener as any).g.sequence_delay = MaxSequenceTimeoutInMillis;
} else if ('sequence_delay' in keyListener) {
// this one is just in case the "global" property starts working some day
(keyListener as any).sequence_delay = MaxSequenceTimeoutInMillis;
}
Is it possible to increase the delay time of a combination? I have longer combinations on my web app like 'a r c g' or 'a r c g k' and they take a bit time to think & press.