Read the statement by Michael Teeuw here.
how and where should I use the hide&show function offered by MM?
-
codes&question updated
setTimeout(shutOtherModule(),10000); function shutOtherModule(){ MM.getModules().exceptModule(this).enumerate(function(module){ module.hide(); }) }
question:
When I put the above codes in start function, the module never hides other modules.
When I put the above codes in notificationReceived function and let MagicMirror do the codes after receiving “DOM_OBJECT_CREATED” notification, It seems that the module shuts down all modules including itself, leaving me with a blank mirror. -
@grasshopper001 join me for a bit in discord and we will solve your problem https://forum.magicmirror.builders/topic/9298/magicmirror-hackathon-2018
-
It seems that MM is not available?
I tried to write shutOtherModule function in node-helper, and MagicMirror told me thatReferenceError: MM is not defined
How could I get access to MM object? Why my MagicMirror responded me with a blank mirror when the function is called after receiving “DOM_OBJECT_CREATED” notification?
-
Finally I deleted the node helper, it seems that MM functions does not work in node helper functions.
But the setTimeout function in notificationReceived function still does not work with “DOM_OBJECT_CREATED”. -
turn on the developers console with Ctrl-Shift=i, or npm start dev, then you can use the console and sources tabs to see errors in the module.js and also put stops on code and look at the variables
as u found, the MM variable is only available in the module.js
-
I use MMM-ModuleScheduler to show or hide modules. It works very simple out of the box.