From 1ce594d540972cd61af1a9940aa386cc673e7858 Mon Sep 17 00:00:00 2001 From: Mike Shoup Date: Fri, 26 Oct 2018 09:08:16 -0600 Subject: [PATCH] Clear window interval before setting a new one Fixes #17 --- html/js/thermostat.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/html/js/thermostat.js b/html/js/thermostat.js index d6ce63c..d159e7a 100644 --- a/html/js/thermostat.js +++ b/html/js/thermostat.js @@ -153,13 +153,15 @@ function appendData(data) { "coolminutes": parseFloat(cmIn.val()), "verbose": configData.verbose }]) - }) - window.setInterval(renderThermostats, 60000); + }); + window.clearInterval(rtHandle); + rtHandle = window.setInterval(renderThermostats, 60000); renderThermostats(); }); var noButton = $("").addClass("button").text("✘").click(function() { - window.setInterval(renderThermostats, 60000); + window.clearInterval(rtHandle); + rtHandle = window.setInterval(renderThermostats, 60000); renderThermostats(); });