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
Introduce `checkKeyComboSequenceIndex` and improve `bindEnvironment` #13
This PR introduces a new method, checkKeyComboSequenceIndex. This method takes a key combo and will return the index of the last currently active sequence in the combo. This will be useful for those who would like to create UI for showing what combos are in progress, and addresses #4. Thanks to @pilliq for suggesting the feature.
It also updates bindEnvironment to optionally take onActive, onInactive, onKeyPressed, onKeyReleased, mapKeyComboEvent, selfReleasingKeys, and keyRemap in an options object exactly like the Keystrokes constructor.
Lastly I've updated the readme to better explain how combo operators work.
This PR introduces a new method,
checkKeyComboSequenceIndex
. This method takes a key combo and will return the index of the last currently active sequence in the combo. This will be useful for those who would like to create UI for showing what combos are in progress, and addresses #4. Thanks to @pilliq for suggesting the feature.It also updates
bindEnvironment
to optionally takeonActive
,onInactive
,onKeyPressed
,onKeyReleased
,mapKeyComboEvent
,selfReleasingKeys
, andkeyRemap
in an options object exactly like the Keystrokes constructor.Lastly I've updated the readme to better explain how combo operators work.