From d6fc20d84b04024d241f72b43893e894197e5371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=20Kl=C3=A4rner?= Date: Sat, 29 May 2021 23:34:23 +0200 Subject: [PATCH] simplify scheduleUpdate() to only read from config nobody else is calling that function with a different delay, so there is no point in making it configurable. --- MMM-GrafanaChart.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/MMM-GrafanaChart.js b/MMM-GrafanaChart.js index d4d05c3..9f7ad6d 100755 --- a/MMM-GrafanaChart.js +++ b/MMM-GrafanaChart.js @@ -19,7 +19,7 @@ Module.register("MMM-GrafanaChart", { // Define start sequence. start: function() { Log.info("Starting module: " + this.name); - this.scheduleUpdate(this.config.refreshInterval); + this.scheduleUpdate(); }, // Override dom generator. getDom: function() { @@ -37,19 +37,15 @@ Module.register("MMM-GrafanaChart", { iframe.setAttribute("scrolling", "no"); return iframe; }, - scheduleUpdate: function(delay) { - var nextLoad = this.config.refreshInterval; - if (typeof delay !== "undefined" && delay >= 0) { - nextLoad = delay * 1000; // Convert seconds to millis - } + scheduleUpdate: function() { var self = this; setTimeout(function() { self.updateFrame(); - }, nextLoad); + }, this.config.refreshInterval*1000); }, updateFrame: function() { Log.info("attempting to update dom for iFrameReload"); this.updateDom(1000); - this.scheduleUpdate(this.config.refreshInterval); + this.scheduleUpdate(); } });