Socket
Socket
Sign inDemoInstall

nkbhook

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nkbhook

A Node JS module to help you hook keyboard events.


Version published
Weekly downloads
3
Maintainers
1
Install size
723 kB
Created
Weekly downloads
 

Readme

Source

Node Keyboard Hook

This Module help you to listen for Keyboard Actions natively. It uses a Java Module (JNativeHook) to intercept the keyboard events. That way you don't need node-gyp to rebuild this module.

Install

npm install --save nkb-hook

Examples

Examples: All the examples are available at 'examples' folder.

var hook = require('../nkbhook.js');

var onPressed = function (pressed) {

    console.log(pressed);
    console.log('You pressed the key with code ' + pressed.code);

};

hook.start().onPressed(onPressed);

Response

The response is a JSON format with the following fields:

{
    action: ..., //Action of event - PRESSED, RELEASED, TYPED
    code: ..., //Key Code
    key: ..., //Key Char
    name: ..., //Key Name
    shift: ..., //If Shift is pressed
    alt: ..., //If alt is pressed
    ctrl: ..., //If ctrl is pressed
    meta: ... //If meta is pressed
}

Table of Key Codes

Esc10x1
1 or !20x2
2 or @30x3
3 or #40x4
4 or $50x5
5 or %60x6
6 or ^70x7
7 or &80x8
8 or *90x9
9 or (100xa
0 or )110xb
- or _120xc
= or +130xd
Bksp140xe
Tab150xf
Q160x10
W170x11
E180x12
R190x13
T200x14
Y210x15
U220x16
I230x17
O240x18
P250x19
[ or {260x1a
] or }270x1b
Enter280x1c
Left Ctrl290x1d
A300x1e
S310x1f
D320x20
F330x21
G340x22
H350x23
J360x24
K370x25
L380x26
; or :390x27
' or "400x28
` or ~410x29
Left Shift420x2a
\ or |430x2b
Z440x2c
X450x2d
C460x2e
V470x2f
B480x30
N490x31
M500x32
, or <510x33
. or >520x34
/ or ?530x35
Right Shift540x36
Prtsc
This is a special case
550x37
Left Alt560x38
Space570x39
Caps Lock580x3a
F1590x3b
F2600x3c
F3610x3d
F4620x3e
F5630x3f
F6640x40
F7650x41
F8660x42
F9670x43
F10680x44
Num Lock690x45
Scroll Lock700x46
Home (Number Pad)710x47
Up Arrow (Number Pad)720x48
Pgup (Number Pad)730x49
Grey - (Number Pad)740x4a
Left Arrow (Number Pad)750x4b
Center (The 5 key on the number pad?)760x4c
Right Arrow (Number Pad)770x4d
Grey + (Number Pad)780x4e
End (Number Pad)790x4f
Down Arrow (Number Pad)800x50
Pgdn (Number Pad)810x51
Ins (Number Pad)820x52
Del (Number Pad)830x53
Enter (Number Pad)573720xe01c
Right Ctrl573730xe01d
Grey / (Number Pad)573970xe035
Right Alt574000xe038
Home574150xe047
Up Arrow 574160xe048
Pgup574170xe049
Left Arrow574190xe04b
Right Arrow574210xe04d
End574230xe04f
Down Arrow574240xe050
Pgdn574250xe051
Ins574260xe052
Del574270xe053
F11574310xe057
F12574320xe058
Left Winkey574350xe05b
Right Winkey574360xe05c

Keywords

FAQs

Last updated on 15 Sep 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc