RobertWHurst / Keystrokes

Keystrokes as an easy to use library for binding functions to keys and key combos. It can be used with any TypeScript or JavaScript project, even in non-browser environments.
MIT License
158 stars 6 forks source link

Implement extendable events #3

Closed RobertWHurst closed 1 year ago

RobertWHurst commented 1 year ago

This PR introduces new type arguments and a mapper function that can be passed as part of the libraries options. The new types allow adding custom event properties to the KeyEvent and KeyComboEvent respectively. The mapper function provides a way for deriving properties for KeyComboEvent from all KeyEvent objects involved in the combo.

This isn't likely isn't useful to users whom wish to use the library in the browser - more relevant to users who wish to use the library in other more custom situations. That said this work was motivated by and provided a way to solve issue #2.

RobertWHurst commented 1 year ago

Will be adding additional event properties and tests