Skip to content

Commit

Permalink
fix(socket): variables not existing
Browse files Browse the repository at this point in the history
Variables existed within the class.
Thus the global variables of the same name didn't exist
  • Loading branch information
TGRHavoc committed May 15, 2021
1 parent 0e0fd8d commit 381659d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions js/src/first_bundle/socket.js
Expand Up @@ -80,7 +80,7 @@ class SocketHandler {

} else if (data.type == "playerData") {
//Config.log("updating players(" + typeof(data.payload) + "): " + JSON.stringify(data.payload));
let sortedPlayers = data.payload.sort(sorter);
let sortedPlayers = data.payload.sort(this.sorter);
this.doPlayerUpdate(sortedPlayers);

} else if (data.type == "playerLeft") {
Expand Down Expand Up @@ -265,11 +265,11 @@ class SocketHandler {
$("#playerSelect option[value='" + playerName + "']").remove();
}

playerCount = Object.keys(localCache).length;
this.playerCount = Object.keys(localCache).length;

Config.log("Playerleft playercount: " + playerCount);
Config.log("Playerleft playercount: " + this.playerCount);

document.getElementById("player_count").innerText = playerCount;
document.getElementById("player_count").innerText = this.playerCount;
}

getPlayerInfoHtml(plr) {
Expand Down Expand Up @@ -425,8 +425,8 @@ class SocketHandler {

self.playerCount = Object.keys(self.localCache).length;

Config.log("playercount: " + playerCount);
document.getElementById("player_count").textContent = playerCount;
Config.log("playercount: " + self.playerCount);
document.getElementById("player_count").textContent = self.playerCount;
}
}

Expand Down

0 comments on commit 381659d

Please sign in to comment.