From 3c4c56f739a0acffb85e6d69c944fbe7a6c79fd9 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Fri, 17 Mar 2017 20:33:31 +0100 Subject: [PATCH] Cosmetics --- Site/Scripts/Swarmops-v5.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 4bf25b56..1b55d0ff 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -124,7 +124,7 @@ function watchHeartbeat() { watchHeartbeat(); }, 10000); - // Have we lost the socket connection? If so, use this to try reconnecting + // Have we lost the socket connection? If so, take this cadence opportunity to try reconnecting if (_error_ClientSocketLost) { console.log(" - trying to reinit socket"); @@ -170,22 +170,18 @@ function updateMalfunctions(serverList) { _master_LastServerMalfunctionsList = JSON.parse(JSON.stringify(serverList)); // deep copy } - if (serverList === undefined) { // init edge case + if (serverList === undefined) { // edge case present on early init serverList = []; _master_LastServerMalfunctionsList = []; } if (_error_ClientSocketLost) { - console.log("Foo2"); serverList.push(constructMalfunctionData("ClientSocket", _errorDisplay_clientSocketLost)); } else if (_masterSocketHeartbeatsLost) { - console.log("Foo1"); serverList.push(constructMalfunctionData("ClientHeartbeat", _errorDisplay_clientHeartbeatLost)); } - console.log("Bar"); - updateListBox($('#divMalfunctionsList'), serverList); } @@ -206,7 +202,7 @@ var _error_ClientSocketLost = false; // ------------------- List updating -------------------------- -function updateListBox(box, listData) { +function updateListBox(box, listArray) { // list is an array of object { id, text } // box is a div-div-ul-li nest containing the li:s with the id // the function syncs the box to the list with some nice fades @@ -221,10 +217,9 @@ function updateListBox(box, listData) { console.log(" - step 1"); - var listArray = listData; console.log(listArray); var idListLookup = {}; - if (listData.length > 0) { + if (listArray.length > 0) { listArray.forEach(function(item, index) { idListLookup[item.Id] = item; });