diff --git a/.dist/localuser.js b/.dist/localuser.js index 3acd991..db4a26f 100644 --- a/.dist/localuser.js +++ b/.dist/localuser.js @@ -112,6 +112,8 @@ class Localuser { User.clear(); } async initwebsocket() { + if (!this.initialized) + return; let returny = null; const promise = new Promise((res) => { returny = res; }); this.ws = new WebSocket(this.serverurls.gateway.toString() + "?encoding=json&v=9" + (DecompressionStream ? "&compress=zlib-stream" : "")); @@ -209,6 +211,8 @@ class Localuser { this.connectionSucceed = 0; document.getElementById("load-desc").innerHTML = "Unable to connect to the Spacebar server, retrying in " + Math.round(0.2 + (this.errorBackoff * 2.8)) + " seconds..."; setTimeout(() => { + if (!this.initialized) + return; document.getElementById("load-desc").textContent = "Retrying..."; this.initwebsocket().then(() => { this.loaduser(); diff --git a/webpage/localuser.ts b/webpage/localuser.ts index 0de184f..97467b9 100644 --- a/webpage/localuser.ts +++ b/webpage/localuser.ts @@ -118,6 +118,7 @@ class Localuser{ User.clear(); } async initwebsocket():Promise{ + if(!this.initialized) return; let returny=null const promise=new Promise((res)=>{returny=res}); this.ws = new WebSocket(this.serverurls.gateway.toString()+"?encoding=json&v=9"+(DecompressionStream?"&compress=zlib-stream":"")); @@ -220,8 +221,8 @@ class Localuser{ document.getElementById("load-desc").innerHTML="Unable to connect to the Spacebar server, retrying in " + Math.round(0.2 + (this.errorBackoff*2.8)) + " seconds..."; setTimeout(() => { + if(!this.initialized) return; document.getElementById("load-desc").textContent="Retrying..."; - this.initwebsocket().then(() => { this.loaduser(); this.init();