Browse Source

network: fix race in networkInterface by adding a ready flag

Yuri Iozzelli 2 years ago
parent
commit
80b4965119
1 changed files with 2 additions and 1 deletions
  1. 2 1
      index.html

+ 2 - 1
index.html

@@ -32,7 +32,7 @@
     <link rel="stylesheet" href="./xterm/xterm.css" />
     <link rel="stylesheet" href="./scrollbar.css" />
     <script>
-        window.networkInterface = {};
+        window.networkInterface = { bind: null, connect: null, listen: null, ready: false };
     </script>
     <script src="./xterm/xterm.js"></script>
     <script src="./xterm/xterm-addon-fit.js"></script>
@@ -90,6 +90,7 @@
         window.networkInterface.bind = bind;
         window.networkInterface.connect = connect;
         window.networkInterface.listen = listen;
+	window.networkInterface.ready = true;
         loginElem.style.cursor = "pointer";
         statusElem.style.color = "white";
         loginElem.onclick = () => {