fix mouse reports and improve timeout handling
This commit is contained in:
+5
-2
@@ -250,8 +250,6 @@ window.onload = (event) => {
|
||||
window.addEventListener("keyup", onKeyUp, true);
|
||||
|
||||
socket = new WebSocket("ws://" + window.location.hostname + ":8080/");
|
||||
//socket.onopen = function (event) { document.getElementById("websocket").innerHTML="connected"; };
|
||||
//socket.onclose = function (event) { document.getElementById("websocket").innerHTML="closed"; };
|
||||
socket.onmessage = function (event) { updateLEDs(event.data); };
|
||||
}
|
||||
|
||||
@@ -332,6 +330,11 @@ function sendKeys(curKeys, is_mouse) {
|
||||
} else {
|
||||
socket.send("K: " + curKeys);
|
||||
}
|
||||
} else if (socket.readyState == WebSocket.CLOSED) {
|
||||
socket = new WebSocket("ws://" + window.location.hostname + ":8080/");
|
||||
setTimeout( function () { sendKeys(curKeys, is_mouse); }, 10);
|
||||
} else {
|
||||
setTimeout( function () { sendKeys(curKeys, is_mouse); }, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Keyboard Indicators</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="num" class="<!--#num-->">NumLock</div>
|
||||
<div id="caps" class="<!--#caps-->">CapsLock</div>
|
||||
<div id="scroll" class="<!--#scroll-->">ScrollLock</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user