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

Question/suggestion: Sequence consecutive? #112

Open
chrjmeyer opened this issue Apr 2, 2016 · 2 comments
Open

Question/suggestion: Sequence consecutive? #112

chrjmeyer opened this issue Apr 2, 2016 · 2 comments
Labels

Comments

@chrjmeyer
Copy link

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);
  };
@dmauro
Copy link
Owner

dmauro commented Apr 3, 2016

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.

@dmauro dmauro added the bug label Apr 3, 2016
@chrjmeyer
Copy link
Author

Ah, cool. Thanks! Meanwhile I've found a good workaround using on_release that works well in our setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants