Keypress
Keypress copied to clipboard
Question/suggestion: Sequence consecutive?
We're using Keypress for lab experiments here at my department and it's tremendously helpful -- awesome job!
I was curious whether I'm missing an easy way to fire an event on a sequence combo being pressed consecutively? In the sequence combo below with q and w, the keyup event fires whenever I hold q and release w (which makes perfect sense). I was looking to fire an event whenever q is pressed and released first, then w is pressed and released after. In other words, when I type "q w". Using on_release
, I get closer because I have to release both keys, but I can keep both of them down at the same time.
Maybe totally unclear -- happy to clarify.
consecseq_detect = function() {
combos = [
{
keys: "q w",
prevent_default: true,
is_sequence: true,
is_solitary: true,
is_exclusive: true,
on_release: function() {
some_node.text("Correct consecutive sequence");
}
}
];
return listener.register_many(combos);
};
Oh, hmmm, sounds like there might be a bug with on_keyup for sequence combos. Using on_keydown is probably your best bet, and I can look into getting on_keyup and release to work properly with sequences.
Ah, cool. Thanks! Meanwhile I've found a good workaround using on_release
that works well in our setting.