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
Add KeyboardEvent goodness to easily bind to key press events #93
Comments
Ooh, nice, I like how you're thinking! IMHO |
@cmeeren You are right, to keep it consistent, we have been using a singular word for modules |
Yep, though I have noticed that we have |
@cmeeren Made an issue about Refinement of the proposalScenario 2.2 is inconsistent with the rest of the event handlers because it means we should also implement As for scenario 1 and scenario 2, the event handlers in there should accept the KeyboardEvent -> unit // default
IKeyboardKey * (KeyboardEvent -> unit) // scenario 1
(IKeyboardKey * (KeyboardEvent -> unit)) list // scenario 2 |
Looks good to me. The proof is in the pudding, though. Let's see how it feels in use. :) |
Keyboard goodness added: // Enter only
prop.onKeyUp (key.enter, fun _ -> dispatch Login)
// Enter + CTRL
prop.onKeyUp (key.ctrl(key.enter), fun _ -> dispatch Login)
// Enter + SHIFT
prop.onKeyUp (key.shift(key.enter), fun _ -> dispatch Login)
// Enter + CTRL + SHIFT
prop.onKeyUp (key.ctrlAndShift(key.enter), fun _ -> dispatch Login) |
I was thinking of adding a nice way to bind to keyboard events, something like the following would be really awesome:
Scenario 1: bind to a single key event (most common use-case)
Scenario 2.1: bind to multiple keys
Scenario 2.2: bind to multiple keys
This is up for grabs! PRs are very much welcome, let me and other contributors know if you want to take a stab at it
The text was updated successfully, but these errors were encountered: