Skip to content

Commit 141750a

Browse files
Merge pull request #5 from Tom-Hirschberger/development
only updateDom if a position is set in the config now
2 parents 2022b99 + 897ed71 commit 141750a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

MMM-Screen-Powersave-Notification.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Module.register("MMM-Screen-Powersave-Notification", {
4343
hours = Math.round((seconds - remainingSeconds) / 3600);
4444
}
4545

46-
remainingSeconds2 = remainingSeconds % 60;
46+
let remainingSeconds2 = remainingSeconds % 60;
4747
var minutes = Math.round((remainingSeconds - remainingSeconds2) / 60);
4848

4949
if (this.config.displayHours) {
@@ -63,6 +63,13 @@ Module.register("MMM-Screen-Powersave-Notification", {
6363
}
6464
},
6565

66+
conditionalUpdateDom: function(animationSpeed){
67+
const self = this
68+
if(typeof self.data.position !== "undefined"){
69+
self.updateDom(animationSpeed)
70+
}
71+
},
72+
6673
getDom: function () {
6774
const wrapper = document.createElement("div");
6875
if (typeof this.data.position !== "undefined"){
@@ -90,8 +97,8 @@ Module.register("MMM-Screen-Powersave-Notification", {
9097
const self = this;
9198
self.currentDelayTimer = setTimeout(function () {
9299
self.currentDelay =
93-
self.currentDelay - self.config.countDownUpdateInterval / 1000;
94-
self.updateDom(self.config.animationSpeed);
100+
self.currentDelay - self.config.countDownUpdateInterval / 1000;
101+
self.conditionalUpdateDom(self.config.animationSpeed);
95102
}, self.config.countDownUpdateInterval);
96103
}
97104
}
@@ -181,7 +188,7 @@ Module.register("MMM-Screen-Powersave-Notification", {
181188
} else {
182189
this.delayDisabled = false;
183190
}
184-
this.updateDom();
191+
self.conditionalUpdateDom(self.config.animationSpeed)
185192
} else if (notification === "SCREEN_HIDE_MODULES") {
186193
self.sendNotification("DISABLE_PROFILE_TIMERS");
187194
if (self.config.changeToProfile !== null) {

0 commit comments

Comments
 (0)