Skip to content

Commit

Permalink
Merge branch 'ewowi:main' into new-frame-only
Browse files Browse the repository at this point in the history
  • Loading branch information
netmindz authored Aug 6, 2023
2 parents 71c892e + c31c638 commit 9332377
Show file tree
Hide file tree
Showing 3 changed files with 651 additions and 632 deletions.
14 changes: 13 additions & 1 deletion data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ function makeWS() {
userFunId = "";
}
else {
clearTimeout(jsonTimeout);
jsonTimeout = null;
gId('connind').style.backgroundColor = "var(--c-l)";
// console.log("onmessage", e.data);
let json = null;
Expand Down Expand Up @@ -83,6 +85,7 @@ function makeWS() {
}
ws.onopen = (e)=>{
console.log("WS open", e);
reqsLegal = true;
}
}

Expand Down Expand Up @@ -539,12 +542,21 @@ function findVar(id, parent = null) {
return foundVar;
}

var jsonTimeout;
var reqsLegal = false;

function requestJson(command) {
gId('connind').style.backgroundColor = "var(--c-y)";
if (!ws) return;
if (command && !reqsLegal) return; // stop post requests from chrome onchange event on page restore
if (!jsonTimeout) jsonTimeout = setTimeout(()=>{if (ws) ws.close(); ws=null; console.log("connection failed")}, 3000);

// if (!ws) return;
let req = JSON.stringify(command);

console.log("requestJson", command);

if (req.length > 1340)
console.log("too big???");

ws.send(req?req:'{"v":true}');

Expand Down
Loading

0 comments on commit 9332377

Please sign in to comment.