0.2.5 • Published 6 years ago

active-keys v0.2.5

Weekly downloads
6
License
Apache-2.0
Repository
github
Last release
6 years ago

active-keys

Know and listen for which keys the user is currently holding down using standard KeyboardEvent#key values.

npm install --save active-keys

import keyWatcher from 'active-keys';
keyWatcher.addEventListener('change', () => {
  console.log(Object.keys(keyWatcher.activeKeys));
});
  • Even handles multiple of the same key held down (e.g. down right Alt, then down left Alt, and then up left Alt - will still indicate Alt down).
  • Includes React helper.
  • Requires support for Set and KeyboardEvent#key.
  • Will err on the side of indicating that a key is inactive.

Live Example

API Docs and Example Code

Demo Recording

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.1

7 years ago