diff options
author | Devaev Maxim <[email protected]> | 2020-06-20 11:29:06 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-06-20 11:29:06 +0300 |
commit | cf2f763d1bd23170cb82e0df9eff363931cc66dc (patch) | |
tree | 541f6cd3b498d2a6ccde3e0921639a588535fdba /web/share/js/kvm/keyboard.js | |
parent | 490e5b352ef569ef5b3f5211523d21bbd5ed0e1c (diff) |
user macro
Diffstat (limited to 'web/share/js/kvm/keyboard.js')
-rw-r--r-- | web/share/js/kvm/keyboard.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/web/share/js/kvm/keyboard.js b/web/share/js/kvm/keyboard.js index 10c6ccc5..e919a840 100644 --- a/web/share/js/kvm/keyboard.js +++ b/web/share/js/kvm/keyboard.js @@ -24,11 +24,13 @@ import {tools, $, $$$} from "../tools.js"; import {Keypad} from "../keypad.js"; -export function Keyboard() { +export function Keyboard(record_callback) { var self = this; /************************************************************************/ + var __record_callback = record_callback; + var __ws = null; var __online = true; @@ -136,12 +138,14 @@ export function Keyboard() { var __sendKey = function(code, state) { tools.debug("Keyboard: key", (state ? "pressed:" : "released:"), code); + let event = { + "event_type": "key", + "event": {"key": code, "state": state}, + }; if (__ws) { - __ws.send(JSON.stringify({ - "event_type": "key", - "event": {"key": code, "state": state}, - })); + __ws.send(JSON.stringify(event)); } + __record_callback(event); }; __init__(); |