MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

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

    Development
    4
    7
    1105
    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
      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
        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

        Create a working config
        How to add modules

        1 Reply Last reply Reply Quote 0
        • G
          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.141 1 Reply Last reply Reply Quote 0
          • strawberry 3.141
            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
              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
                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
                  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

                  Create a working config
                  How to add modules

                  1 Reply Last reply Reply Quote 0
                  • A
                    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 Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
                    This forum is using NodeBB as its core | Contributors
                    Contact | Privacy Policy