1.1.0 • Published 5 months ago

@smiilliin/keyhook v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

Keyhook

node global keyboard hooking library for windows

Usage

VKey

https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes

registerShortcut

register a shortcut | shortcuts | callback | noRepeat(default true) | | ---| ---| ---| |keys array(VKey or one char key)| callback | whether to repeat detacting or not|

unregisterHook

unregister a shortcut | shortcuts | noRepeat(default true) | | ---| ---| |keys array(VKey or one char key)| whether to repeat detacting or not|

cleanShortcuts

remove all shortcuts

getShortcutsCount

get shortcuts count

registerHook

register hooking interval | interval(default 0) | | ---| |setInterval interval|

unregisterShortcut

unregister hooking interval

Detacting ctrl + s example

import {
  unregisterHook,
  registerHook,
  registerShortcut,
  VKey,
} from "@smiilliin/keyhook";

registerShortcut([VKey.VK_CONTROL, "s"], () => {
  console.log("ctrl + s detacted!");
  unregisterHook();
});
registerHook();

Build

Install packages

npm install

Build typescript code

npm run build

Test

Test this package with mocha

npm run test
1.1.0

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago