blob: cb6c37bf73f440388c61434249a211c8b93493fa (
plain)
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
|
var hid = new function() {
this.init = function() {
keyboard.init();
mouse.init();
};
this.updateLeds = function() {
keyboard.updateLeds();
mouse.updateLeds();
};
this.releaseAll = function() {
keyboard.releaseAll();
};
this.emitShortcut = function(...codes) {
tools.debug("Emitted keys:", codes);
var delay = 0;
[[codes, true], [codes.slice().reverse(), false]].forEach(function(op) {
var [op_codes, state] = op;
op_codes.forEach(function(code) {
setTimeout(() => keyboard.fireEvent(code, state), delay);
delay += 100;
});
});
};
this.installCapture = function(ws) {
keyboard.setSocket(ws);
mouse.setSocket(ws);
};
this.clearCapture = function() {
mouse.setSocket(null);
keyboard.setSocket(null);
};
}
|