From b1b07fc00c8b6f87dc152ce9cac72c2efed93797 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Jakse?= Date: Sun, 12 Apr 2020 20:14:35 +0200 Subject: [PATCH] Lint --- trivabble-server.js | 21 ++++++++------------- trivabble.js | 2 -- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/trivabble-server.js b/trivabble-server.js index 8ab91bd..4171a1e 100644 --- a/trivabble-server.js +++ b/trivabble-server.js @@ -259,14 +259,12 @@ Game.prototype.setPlayerScore = function (player, score) { this.scores[playerID] = score; - this.pendingEvents.push( - { - players: [{ - player: player, - score: score - }] - } - ); + this.pendingEvents.push({ + players: [{ + player: player, + score: score + }] + }); }; Game.prototype.playerJoined = function (playerName) { @@ -322,9 +320,8 @@ Game.prototype.addListeningPlayer = function (playerName, responseAndIsES) { }; Game.prototype.commit = function () { - const pendingEvents = this.pendingEvents; + const msg = JSON.stringify(this.pendingEvents); this.pendingEvents = []; - const msg = JSON.stringify(pendingEvents); for (let i = 0; i < this.listeningPlayers.length; i++) { while (i < this.listeningPlayers.length && !this.listeningPlayers[i]) { @@ -595,8 +592,6 @@ function handleCommand(cmd, gameNumber, playerName, response) { const initialRackCount = countTiles(rack); const rackCount = countTiles(cmd.rack); - debuglog(rack, cmd.rack); - if (initialRackCount !== rackCount) { response.write( JSON.stringify({ @@ -758,7 +753,7 @@ function handleRequest(request, response) { }; for (const i in mimes) { - if (request.url.endsWith(i)) { + if (Object.prototype.hasOwnProperty.call(mimes, i) && request.url.endsWith(i)) { mime = mimes[i]; break; } diff --git a/trivabble.js b/trivabble.js index bc28e16..1eaa173 100644 --- a/trivabble.js +++ b/trivabble.js @@ -862,8 +862,6 @@ pollServerWithEventSource(); return; } - - console.log("Websocket connection has been closed", e); retryPolling(); }; } -- 2.30.2