Socket
Socket
Sign inDemoInstall

get-key

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-key

Key identifier


Version published
Maintainers
1
Created
Source

get-key-js

Key identifier

API

getKey(e)

Returns a string identifying the key pressed to generate keydown or keyup event e, including modifiers.

Results look like "ctrl+shift+f". Formally, they consist of all held modifiers in the order "ctrl", "alt", "shift", then "windows", each followed by "+", followed by the label on the key, all in lowercase with spaces removed.

Mac-specific modifiers are given as their standard (near-)equivalents: Option is "alt" and Command is "ctrl". Unrecognized keys are given as "unrecognized"; only custom hardware should return "unrecognized", if it happens otherwise then please open an issue.

Please note well that get-key-js works with keys, not characters. For example, pressing "shift+4" yields "shift+4" (what was pressed), not "$" (what was typed, maybe, depending on the layout and system settings).

Setup

Install: npm install get-key

Import: const getKey = require('get-key');

FAQs

Package last updated on 18 Jul 2016

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc