From 71636a5b4c0ea52167a5126cb1184994731a968f Mon Sep 17 00:00:00 2001 From: "Sascha L. Teichmann" Date: Fri, 13 Mar 2015 15:03:10 +0100 Subject: [PATCH] Fix state switching auto-update/manual refresh. --- cmd/mtwebmapper/web/js/auto-update.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/mtwebmapper/web/js/auto-update.js b/cmd/mtwebmapper/web/js/auto-update.js index bb6b806..cfb8b42 100644 --- a/cmd/mtwebmapper/web/js/auto-update.js +++ b/cmd/mtwebmapper/web/js/auto-update.js @@ -39,8 +39,9 @@ L.Control.AutoUpdate = L.Control.extend({ stopUpdate: function() { if (this.socket) { - this.socket.close(); + var s = this.socket; this.socket = null; + s.close(); } }, @@ -53,7 +54,9 @@ L.Control.AutoUpdate = L.Control.extend({ me.switchButtons(); }; - this.socket.onclose = this.socket.onerror; + this.socket.onclose = function(evt) { + this.socket = null; + } this.socket.onopen = function(evt) { // Sending pings every 5 secs to keep connection alive.