pyfisch / keyboard-types

Types to define keyboard related events.
Apache License 2.0
54 stars 9 forks source link

String to code #10

Closed stephanemagnenat closed 3 years ago

stephanemagnenat commented 3 years ago

PR #4 added FromStr trait for Key, however, there is no equivalent for Code. When used on the web, it feels natural to me to want to create a Code from an js_sys::KeyboardEvent::code(). Given that the two specification files are somewhat similar, it should not be too hard to add. Or do I miss something?

pyfisch commented 3 years ago

Code is very similar to Key. One needs to change convert.py to add an implementation and then rebuild the crate.

You want to send a PR?

stephanemagnenat commented 3 years ago

PR done, see #11.