diff options
author | Devaev Maxim <[email protected]> | 2018-07-25 23:01:28 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-07-25 23:01:28 +0300 |
commit | 940fe28a9f717236a24f18930d14ff2804155480 (patch) | |
tree | a98117ae6fdbc990b4b987de0b17a18c2cd66d31 /kvmd/web/js/hid.js | |
parent | e2e8001ba8dec95742e6c121c7252b4fd5634b7d (diff) |
simplified hid
Diffstat (limited to 'kvmd/web/js/hid.js')
-rw-r--r-- | kvmd/web/js/hid.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/kvmd/web/js/hid.js b/kvmd/web/js/hid.js index 3d0ed961..2e5538da 100644 --- a/kvmd/web/js/hid.js +++ b/kvmd/web/js/hid.js @@ -1,15 +1,20 @@ var hid = new function() { var __install_timer = null; + this.init = function() { + keyboard.init(); + mouse.init(); + } + this.installCapture = function(ws) { var http = tools.makeRequest("GET", "/kvmd/hid", function() { if (http.readyState === 4) { if (http.status === 200) { features = JSON.parse(http.responseText).result.features; if (features.mouse) { - mouse.installCapture(ws); + mouse.setSocket(ws); } - keyboard.installCapture(ws); + keyboard.setSocket(ws); } else { tools.error("Can't resolve HID features:", http.responseText); __install_timer = setTimeout(() => hid.installCapture(ws), 1000); @@ -23,7 +28,7 @@ var hid = new function() { clearTimeout(__install_timer); __install_timer = null; } - mouse.clearCapture(); - keyboard.clearCapture(); + mouse.setSocket(null); + keyboard.setSocket(null); }; } |