Read the statement by Michael Teeuw here.
updateDom() blocks MagicMirror
-
@sdetweil Is there a Json parser I can use?
-
@1blaunitrox said in updateDom() blocks MagicMirror:
Why can getDom() not transfrom the array in a readable string?
getDom() CAN do anythign YOU implement… it does NOTHING by itself…
-
@sdetweil JSON.parse, JSON. stringify
u have an object so, stringify turns it into text
parse takes text and makes an object -
@sdetweil What about
JSON.stringify(this.response);
-
@1blaunitrox that would work
but it will be the JSON text representation of the object
all fields and values
-
@sdetweil
First: Is there an other option?Second: I added the getData() function in getDom()
const wrapper = document.createElement("div"); this.getData(); if(this.response.lenght <= 0) { wrapper.innerHTML = "No Entries"; } else { wrapper.innerHTML = JSON.stringify(this.response); } return wrapper;
Now the mirror show
UNDEFINED
again -
-
@1blaunitrox this.getData() is not synchronous, so it will return long before the data is ready
don’t call from getDom()
-
see the doc
https://docs.magicmirror.builders/development/introduction.html#module-structure
https://docs.magicmirror.builders/development/core-module-file.html#subclassable-module-methods
notificationReceived in particular -
@sdetweil Do you remember my problem yesteray that my magic mirror doesn`t start? I started the program today in the morning. Without doing anythink since yesterday evening, the same error occurs.
The only think I change was that I renamed lenght to length. Than I deleted the module module and copyed the new one.
old post: https://forum.magicmirror.builders/topic/16233/error-while-starting-magic-mirror/29