Socket
Book a DemoInstallSign in
Socket

active-keys

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

active-keys

Know and listen for which keys the user is currently holding down. Includes React helper.

latest
Source
npmnpm
Version
0.2.5
Version published
Weekly downloads
4
-69.23%
Maintainers
1
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 02 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts