joystick
joystick copied to clipboard
Consider an API for keyboard events
Technically the existing events API can do this but it's cumbersome. Would be good if you could just map keys to a function on a component. That way keyboard-commanded UIs are easy to build.
Kind of like the API idea of having something like:
keyboard: [
{ key: 's', modifier: 'cmd|ctrl', handler: () => {} }
],
The idea being that you have an array of keyboard events that are either a single key or a key + modifier associated with a handler function that does something when that event is triggered.
Only real headache is either using short-hand modifier keys like cmd or command (or ctrl vs control). I think just spelling it out is more Joystick style and predictable.