Skip to content

Commit 9b1b134

Browse files
author
wilix-lead
committed
+ Fix cross compilation for linux x64
+ Update typings + Cleanup repository + Fix stop() on shortcut registered
1 parent 44c5935 commit 9b1b134

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

examples/example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ let shId = ioHook.registerShortcut([ALT, F7], (keys) => {
3535
ioHook.unregisterShortcut(shId);
3636
})
3737

38-
console.log('Hook started. Try type something or move mouse');
38+
console.log('Hook started. Try type something or move mouse');

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
'use strict';
2-
const os = require('os');
32
const EventEmitter = require('events');
43
const path = require('path');
54

@@ -116,7 +115,7 @@ class IOHook extends EventEmitter {
116115
* @param {Boolean} mode
117116
*/
118117
setDebug(mode) {
119-
NodeHookAddon.debugEnable(mode ? true : false);
118+
NodeHookAddon.debugEnable(mode);
120119
}
121120

122121
/**
@@ -151,6 +150,9 @@ class IOHook extends EventEmitter {
151150
* @private
152151
*/
153152
_handleShortcut(event) {
153+
if (this.active === false) {
154+
return;
155+
}
154156
if (event.type === 'keydown') {
155157
this.shortcuts.forEach(shortcut => {
156158
if (shortcut[event.keycode] !== undefined) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iohook",
3-
"version": "0.1.12",
3+
"version": "0.1.13",
44
"description": "Node.js global keyboard and mouse hook",
55
"main": "index.js",
66
"types": "index.d.ts",

0 commit comments

Comments
 (0)