forked from coldKey1/mouse-hooks
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathexample.js
More file actions
35 lines (28 loc) · 705 Bytes
/
Copy pathexample.js
File metadata and controls
35 lines (28 loc) · 705 Bytes
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
const mouseEvents = require("./index");
mouseEvents.on("mouseup", data => {
console.log(data);
});
mouseEvents.on("mousemove", data => {
console.log(data);
});
mouseEvents.on("mousedown", data => {
console.log(data);
});
mouseEvents.on("mousewheel", data => {
console.log(data);
});
setInterval(() => {
if (!mouseEvents.getPaused()) {
console.error("Still listening...");
}
}, 5000);
process.on("SIGBREAK", () => {
if (mouseEvents.getPaused()) {
console.error("resuming mouse events");
mouseEvents.resumeMouseEvents();
} else {
console.error("pausing mouse events");
mouseEvents.pauseMouseEvents();
}
});
console.error("Press Ctrl+Break to toggle listening");