Read the statement by Michael Teeuw here.
UpdateDom not working
-
@sharmmoh1983
Yes. If you have not declared position, it will cause error when you callupdateDom
you can check ‘this.postion’. I use like these;if(this.data.position) { this.updateDom() } else { //nothing to do }
-
But in my case I have declared positions in my config . But my issue is if positions of module somehow overlaps or matches top or bottom (like in my case top_left and top_center ) is causing the issue
-
Kindly assist me in getting this resolved as I am stuck .
I am planning to hide modules upfront and the enable through voice as in when required
-
@sharmmoh1983 I’m not sure if the positions of the modules have anything to do with your problem, but I did struggle with a similar problem in one of my modules. Basically you can’t do ANYTHING with the Dom until MM has finished creating all the Dom objects. This will happen well after your module’s
start()
function is called.Basically you need to wait for the notification
DOM_OBJECTS_CREATED
before you can do things like hide or show the module. Here’s an example:notificationReceived: function(notification, payload, sender) { if ( notification == 'DOM_OBJECTS_CREATED') { //now the Dom is ready; you can call hide() or show(). this.hide(0, {lockString: this.identifier}); } }
I hope this helps!
-
But in that case all my modules will be appearing on screen which I don’t want and should only appear at voice command
-
@sharmmoh1983 Not the case, especially if you call
hide(0)
. This all happens before a single screen refresh, so you won’t see the module on-screen for a split second before it hides. -
@j-e-f-f
I want all modules to hide during start -
@sharmmoh1983 instead of hide, how about using display:none in css?
-
Now i understand whats going on. You had tried to hide modules before dom created.
My suggetion is;- use css for making modules invisible with display:none on startup.(or cover all modules with temp div which has black background on top level)
- after Dom_object_created message received, hide all module with .hide().
- then change css again for displaying, or remove the covered div.
- then you can use your command.
-
@Sean
I will look into the approach but I don’t want every module to be off , some commanded by voice so can’t make use of css