forked from wilix-team/iohook
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
96 lines (79 loc) · 2.18 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import { EventEmitter } from 'events'
/**
* Native module for hooking keyboard and mouse events
*/
declare class IOHook extends EventEmitter {
/**
* Start hooking engine. Call it when you ready to receive events
* @param {boolean} enableLogger If true, module will publish debug information to stdout
*/
start(enableLogger: boolean): void
/**
* Stop rising keyboard/mouse events
*/
stop(): void
/**
* Manual native code load. Call this function only if unload called before
*/
load(): void
/**
* Unload native code and free memory and system hooks
*/
unload(): void
/**
* Enable/Disable stdout debug
* @param {boolean} mode
*/
setDebug(mode: boolean): void
/**
* Enable keyboard propagation (enabled by default).
* The keyboard event are emitted and propagated.
*/
enableKeyboardPropagation(): void
/**
* Disable keyboard propagation.
* The keyboard event are captured and the event emitted but not
propagated to the window
*/
disableKeyboardPropagation(): void
/**
* Enable mouse click propagation (enabled by default).
* The click event are emitted and propagated.
*/
enableClickPropagation(): void
/**
* Disable mouse click propagation.
* The click event are captured and the event emitted but not propagated to the window.
*/
disableClickPropagation(): void
enableMovePropagation(): void
disableMovePropagation(): void
/**
* Register global shortcut. When all keys in keys array pressed, callback will be called
* @param {Array<string|number>} keys Array of keycodes
* @param {Function} callback Callback for call when shortcut pressed
* @return {number} ShortcutId for unregister
*/
registerShortcut(keys: Array<string|number>, callback: Function): number
/**
* Unregister shortcut by ShortcutId
* @param {number} shortcutId
*/
unregisterShortcut(shortcutId: number): void
/**
* Unregister all shortcuts
*/
unregisterAllShortcuts(): void
}
declare interface IOHookEvent {
type: string
keychar?: number
keycode?: number
rawcode?: number
button?: number
clicks?: number
x?: number
y?: number
}
declare const iohook: IOHook;
export = iohook