fix mouse reports and improve timeout handling

This commit is contained in:
2025-07-20 21:34:56 -04:00
parent c7d70c669b
commit 99824ee2a6
8 changed files with 357 additions and 400 deletions
+5 -2
View File
@@ -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);
}
}
-15
View File
@@ -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>