Keystrokes Versions Save

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.

v1.5.6

1 month ago

A small release which fixes case insensitivity for checkKey.

Special thanks to @Elliot67 for reporting the issue, and submitting a PR with a fix.

v1.5.5

2 months ago

A small bugfix release. @se-panfilov discovered that key aliases were not working for checkKey or bindKey. This release resolves the issue by allowing the use of aliases for these functions in the same way they can be used for bindKeyCombo.

Special thanks to @se-panfilov for reporting the issue.

v1.5.4

4 months ago

This release fixes a bug introduced in v1.5.4 which broke combo handling. Make sure you upgrade any 1.5.x dependent projects to this release.

Thank you @Bernankez for reporting the issue.

v1.5.0

5 months ago

This release introduces the ability to bind code values with the default browser bindings. This is great for those who want to bind keys by their physical location on the keyboard rather than their key value.

To bind a code instead of key, prefix with @. For example, to bind what is the A and B key on a US keyboard the combo @KeyA + @KeyB can be used. This will bind keys in the same location on all other keyboards regardless of the label printed on the key or it's key value. See the readme for more information.

Special thanks to @vladdekhanov for suggesting this feature.

v1.3.0

6 months ago

This release introduces the ability to bind (and unbind) more than one key or combo at the same time. Thanks to @qiongshusheng for the suggestion.

bindKey(['a', 'b'], handleAOrB)
bindKeyCombo(['a+x', 'b+x'], handleAXOrBX)

v1.2.3

8 months ago

This release features a refinement of sequence behavior. It was found that it was possible to press keys between a completed sequence.

Special thanks to @jasonish for reporting the issue that lead to this change.

v1.2.1

8 months ago

This is a small but important release regarding how key repeat events are handled. When I wrote the logic that handles combo key repeat I assumed that the last key pressed is always the key the repeats, but this isn't the case. I discovered this while fixing #21. I've adjusted the logic which checks combos to store the last unit (keys that can be pressed in any order) of a combo rather than the last key pressed. This allows Keystrokes to check if the repeating key is part of the set, and thus combos properly work with key repeat even if pressed in strange orders with strange modifier keys 😅

Again thanks to @silverwind for reporting the issue that lead to this release.

v1.2.0

9 months ago

For this release of Keystrokes I've changed the way key combos are executed so that you can interact with events. This means that things like calling preventDefault are accounted for correctly. This is an important change, and a bit of an glaring omission in my opinion. In anycase it is now possible to call prevent default in a combo as follows:

bindKeyCombo('control > s', (event) => {
  event.finalKeyEvent.preventDefault()
  // ...
})

Special thanks to @silverwind for raising an issue about this.

v1.1.5

9 months ago

So this release includes a fix for the vue package which had been broken by me when moving from parcel to vite. There was also an issue where cjs files for commonjs projects where missing from the packages. Special thanks to @george-martinec for pointing out the broken import for the vue package.

v1.1.2

9 months ago

This is a rather small release which fixes a bug where setting up a key remap was not possible because it was not handled within bind environment as it should. Thanks to @DarkLight1337 for reporting the issue.