Skip to content

Commit

Permalink
fix constants
Browse files Browse the repository at this point in the history
  • Loading branch information
qchateau committed Sep 18, 2020
1 parent c366aaf commit 95281ab
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,18 +429,19 @@ class GameManager {
}

onInput(input) {
const OPEN = 1;
const CLOSED = 3;

if (
(!this.currentGame || this.currentGame.sock.readyState == CLOSED) &&
(!this.currentGame ||
this.currentGame.sock.readyState == WebSocket.CLOSED) &&
this.inputIsAValidation(input)
) {
this.newGame();
return;
}

if (this.currentGame && this.currentGame.sock.readyState == OPEN) {
if (
this.currentGame &&
this.currentGame.sock.readyState == WebSocket.OPEN
) {
this.currentGame.onInput(input);
}
}
Expand Down

0 comments on commit 95281ab

Please sign in to comment.