MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    how and where should I use the hide&show function offered by MM?

    Scheduled Pinned Locked Moved Solved Development
    7 Posts 4 Posters 1.8k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G Offline
      grasshopper001
      last edited by

      I tried to hide all other modules except the current module, but it seems does not work. I put my codes to hide other modules inside the start function of the current module.

      
      Module.register("MMM-hideOtherModules",{
          defaults:{},
          start:function(){
               setTimeout("shutOtherModule",5000);
               function shutOtherModule(){
                   MM.getModules().exceptModule(this).enumerate(function(module){
                       module.hide();
                   })
               }
          },
      //not important functions
      }
      

      Could anyone help me with a sample module to hide other modules? Are there any place to learn about the inner structure of inter-modules communication except the doc?

      1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil
        last edited by sdetweil

        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

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 1
        • G Offline
          grasshopper001
          last edited by

          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.

          strawberry 3.141S 1 Reply Last reply Reply Quote 0
          • strawberry 3.141S Offline
            strawberry 3.141 Project Sponsor Module Developer @grasshopper001
            last edited by

            @grasshopper001 join me for a bit in discord and we will solve your problem https://forum.magicmirror.builders/topic/9298/magicmirror-hackathon-2018

            Please create a github issue if you need help, so I can keep track

            1 Reply Last reply Reply Quote 0
            • G Offline
              grasshopper001
              last edited by

              It seems that MM is not available?
              I tried to write shutOtherModule function in node-helper, and MagicMirror told me that

              ReferenceError: 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?

              1 Reply Last reply Reply Quote 0
              • G Offline
                grasshopper001
                last edited by

                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”.

                1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil
                  last edited by sdetweil

                  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

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 1
                  • A Offline
                    Arjan Project Sponsor
                    last edited by

                    I use MMM-ModuleScheduler to show or hide modules. It works very simple out of the box.

                    1 Reply Last reply Reply Quote 1
                    • 1 / 1
                    • First post
                      Last post
                    Enjoying MagicMirror? Please consider a donation!
                    MagicMirror created by Michael Teeuw.
                    Forum managed by Sam, technical setup by Karsten.
                    This forum is using NodeBB as its core | Contributors
                    Contact | Privacy Policy