Commit a77e7f7f authored by Michiel Eggermont's avatar Michiel Eggermont

CHANNELMGR-75 Small improvements after code-review

Moved setting isReloading flag and logging closer to where the actual reload is done.
Clarified why isReloading is set to true while disconnecting.
parent a456ead9
......@@ -29,16 +29,18 @@
return "ws://" + document.location.host + CONTEXT_PATH + AUTO_RELOAD_PATH;
}
function reloadPage() {
window.document.location.reload();
}
function log(msg) {
if (typeof console.log === "function") {
console.log("Hippo auto-reload " + msg);
}
}
function reloadPage() {
log("is reloading page...");
isReloadingPage = true;
window.document.location.reload();
}
function onOpen() {
isReloadingPage = false;
isReconnecting = false;
......@@ -49,8 +51,6 @@
function onMessage(event) {
var message = JSON.parse(event.data);
if (message.command === "reloadPage") {
log("is reloading page...");
isReloadingPage = true;
reloadPage();
} else {
log("received unknown message:", message);
......@@ -84,7 +84,7 @@
function disconnect() {
if (websocket) {
isReloadingPage = true;
isReloadingPage = true; // prevent reconnect
websocket.close();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment