Closed qiongshusheng closed 1 year ago
Hi @qiongshusheng, thanks for the suggestion. Indeed this is a feature that KeyboardJS has that I left out of Keystrokes. I didn't introduce it because I thought I'd keep things simple to start with, and see if someone asks for it. Now that you have, I'll add it.
Check out PR #26. I'll merge and publish in the next day or so.
@RobertWHurst Thank you very much for your reply and contribution. I will replace KeyboardJs with Keystrokes in my project. After the array is supported, can you combine bindKey and bindKeyCombo into one interface? In this way, it is easier to use the interface without distinguishing whether it is a key combination or not?
Keystroke can, like KeyboarJs, support merging strings and data, as shown in the following example:
KeyboarJs: keyboardJS.bind('a + b > c', (e) => { console.log('a and b then c is pressed'); }); keyboardJS.bind(['a + b > c', 'z + y > z'], (e) => { console.log('a and b then c or z and y then z is pressed'); });
Keystroke: bindKey('a', , () => console.log('You\'re pressing "a"')) bindKey(['a', 'b'] () => console.log('You\'re pressing "a" or "b"'))