mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-22 05:07:05 +00:00
Only call updateDom in clock.js when the content has changed
This commit is contained in:
@@ -41,8 +41,11 @@ Module.register("clock",{
|
||||
|
||||
// Schedule update interval.
|
||||
var self = this;
|
||||
self.lastDisplayedMinute = null;
|
||||
setInterval(function() {
|
||||
self.updateDom();
|
||||
if (self.config.displaySeconds || self.lastDisplayedMinute !== moment().minute()) {
|
||||
self.updateDom();
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
// Set locale.
|
||||
@@ -75,6 +78,7 @@ Module.register("clock",{
|
||||
// See issue: https://github.com/MichMich/MagicMirror/issues/181
|
||||
var timeString;
|
||||
var now = moment();
|
||||
this.lastDisplayedMinute = now.minute();
|
||||
if (this.config.timezone) {
|
||||
now.tz(this.config.timezone);
|
||||
}
|
||||
|
Reference in New Issue
Block a user