A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
Read the statement by Michael Teeuw here.
Help with updateDom()
-
@UjwalReddy267 your pointer ‘this’ is wrong inside the timer handle
setInterval(function() {this.updateDom()
you need to do
var self=this
and in the handler use self instead
setInterval(function() {self.updateDom()
-
@lavolp3 NOw I have the error, I think!
the
this
in the interval might refer to another this and not to the original module-this
So you need to do the following in start:start : function(){ var self = this; setInterval(function() {self.updateDom()}, 1000); },
-
@sdetweil You were faster sam!
-
This post is deleted! -
@sdetweil said in Help with updateDom():
@UjwalReddy267 your pointer ‘this’ is wrong inside the timer handle
setInterval(function() {this.updateDom()
you need to do
var self=this
and in the handler use self instead
setInterval(function() {self.updateDom()
Yes, that was the error, thank you it works now.
-
better use this …
start : function(){ setInterval( () => {this.updateDom()}, 1000); },