interactive hid leds

This commit is contained in:
Devaev Maxim
2018-07-28 13:23:27 +03:00
parent c3939214bf
commit 01e5a8caee
7 changed files with 124 additions and 14 deletions

View File

@@ -29,7 +29,12 @@ var keyboard = new function() {
this.setSocket = function(ws) {
keyboard.releaseAll();
__ws = ws;
$("hid-keyboard-led").className = (ws ? "led-on" : "led-off");
keyboard.updateLeds();
};
this.updateLeds = function() {
var focused = (__ws && (document.activeElement === $("stream-window") || document.activeElement === $("keyboard-window")));
$("hid-keyboard-led").className = (focused ? "led-on" : "led-off");
};
this.releaseAll = function(ws) {