Add server status light

This commit is contained in:
66945
2022-03-07 22:55:29 -07:00
parent 2d68776157
commit 0d627016db
2 changed files with 23 additions and 3 deletions
@@ -16,6 +16,11 @@
let elt = document.getElementById('calculator');
let calculator = Desmos.GraphingCalculator(elt);
let coord = {
x: window.innerWidth - 20,
y: window.innerHeight - 20
};
let helperExpressions = {};
let variables = [];
@@ -33,11 +38,29 @@
}
function handleError() {
let pcoord = calculator.pixelsToMath(coord);
calculator.setExpression({
id: 'status',
latex: '(' + pcoord.x + ',' + pcoord.y + ')',
color: '#ff0000',
pointSize: '20',
secret: true
});
console.log('Request failed');
setTimeout(requestVariables, 0);
}
function setVariables() {
let pcoord = calculator.pixelsToMath(coord);
calculator.setExpression({
id: 'status',
latex: '(' + pcoord.x + ',' + pcoord.y + ')',
color: '#00ff00',
pointSize: '20',
secret: true
});
variables = JSON.parse(this.responseText);
for(let variable of variables) {
@@ -71,9 +71,6 @@ public class DesmosServer extends Thread {
while(true) {
Socket client = serverSocket.accept();
// Indicate Active to desmos client
DesmosServer.putInteger("Active", 1);
handleClient(client);
}
}