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
156 stars 6 forks source link

Cannot use key aliases with bindKey or checkKey #38

Closed se-panfilov closed 8 months ago

se-panfilov commented 8 months ago

Hope I'm note doing things wrong, but it looks like that key codes functionality (issue#33) is broken at least at v1.5.4

bindKey("a", () => console.log("a key")); //working
bindKey("@KeyW", () => console.log("w code")); //doesn't work

codesandbox: https://codesandbox.io/p/sandbox/keystroke-codes-issue-3n9nny

P.S. with 1.5.0 it's working, but I didn't make it work with numpad, e.g. bindKey("@KeyNumpad4", () => console.log("4 code"))

RobertWHurst commented 8 months ago

Hi @se-panfilov. I took a closer look. Key aliases are working for bindKeyCombo, but you are correct - they are not working with bindKey or checkKey. Thanks for reporting the issue, it's greatly apreciated.

I've deployed a fixed version (v1.5.5)

Let me know if you run into further issues.