0.1.2 • Published 7 years ago

nkbhook v0.1.2

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

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