Read the statement by Michael Teeuw here.
UpdateDom not working
-
@sharmmoh1983 said in UpdateDom not working:
I want all modules to hide during star
Yep you can do it. the
MM
object has a method calledgetModules()
which will give you all the loaded modules. Example:var modules = MM.getModules(); modules.enumerate(function(module) { module.hide(0, {lockString: "yourLockString"}); });
-
@j-e-f-f But where it call this as all modules will be loaded simultaneously
-
@j.e.f.f But where to call mentioned code as all modules will be loaded simultaneously
-
@sharmmoh1983 call it in your routine that responds to the
DOM_OBJECTS_CREATED
notification.You can’t hide a module before its Dom exists. When this notification is dispatched it means all modules have started AND their Dom objects have been created for the first time. It’s the earliest opportunity you have to hide any modules.
-
@j.e.f.f I am not generating DOM while start of the module but at voice command and this approach is working individually for the modules but not if all are coupled together So how come it is happening for individual modules
-
@sharmmoh1983 all the Dom objects for all modules are created automatically when MagicMirror starts. This is not under your control, even for your own module. Your
getDom()
routine is called when your module’s Dom object is initially created. This is why it is common to see a conditional ingetDom()
routines that returns something like a simple string (e.g.: “Loading…”). Once your Dom object has been created, you can callupdateDom()
at your discretion to make changes to whatever your module displays. If you don’t want your module to display anything, then don’t specify a location in the config for your module. If a location is specified, SOMETHING will appear there, even if you don’t have agetDom()
routine.You can’t make changes to another module’s Dom object, but you can hide or show it. However, you can’t do that until that Dom object is initially created.
When all the Dom objects for all modules have been created at startup, MagicMirror dispatches the
DOM_OBJECTS_CREATED
notification. By waiting for this notification, you can be sure that any module you attempt to hide will be hidden. -