Skip to content

Commit

Permalink
simplify scheduleUpdate() to only read from config
Browse files Browse the repository at this point in the history
nobody else is calling that function with a different delay, so there is no point in making it configurable.
  • Loading branch information
klaernie committed Apr 2, 2023
1 parent 6cfe099 commit d6fc20d
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions MMM-GrafanaChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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();
}
});

0 comments on commit d6fc20d

Please sign in to comment.