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.

    (2.1.0, API) Revising the Show/Hide mechanism

    Scheduled Pinned Locked Moved Upcoming Features
    14 Posts 5 Posters 14.1k 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.
    • I Offline
      ianperrin
      last edited by

      @MichMich

      Does this fit the use case?

      ModuleA is configured to be hidden at 9am and shown at 6pm by ModuleB using a schedule.

      At 9am ModuleB (the scheduler) hides ModuleA.

      At 11am ModuleC (Remote Control) is used to show ModuleA.

      At 11:30am ModuleC (Remote Control) is used to hide ModuleA.

      At 6pm, ModuleB (the scheduler) shows ModuleA

      Am I correct in thinking that without the force flag, neither ModuleB or ModuleC could show ModuleA at 11am or 6pm respectively?

      "Live as if you were to die tomorrow. Learn as if you were to live forever." - Mahatma Gandhi

      1 Reply Last reply Reply Quote 0
      • MichMichM Offline
        MichMich Admin
        last edited by

        Yeah, but I think that is the exact reason why this method should be implemented. One can argue what the desired result is. But by implementing the force option, both scenarios will be possible. Implementing a force function isn’t really a big deal.

        Thanks for your input!

        1 Reply Last reply Reply Quote 0
        • I Offline
          ianperrin
          last edited by

          Agreed.

          And perhaps best practice should be that any module wishing to show/hide other modules should include a config option to toggle the use of the force flag.

          Let the user decide!

          "Live as if you were to die tomorrow. Learn as if you were to live forever." - Mahatma Gandhi

          1 Reply Last reply Reply Quote 0
          • MichMichM Offline
            MichMich Admin
            last edited by

            Agee! I’ll make sure to add that to the documentation.

            1 Reply Last reply Reply Quote 0
            • MichMichM Offline
              MichMich Admin
              last edited by

              Method is implemented. See documentation:
              https://github.com/MichMich/MagicMirror/tree/develop/modules#thishidespeed-callback-options
              https://github.com/MichMich/MagicMirror/tree/develop/modules#thisshowspeed-callback-options
              https://github.com/MichMich/MagicMirror/tree/develop/modules#visibility-locking

              J 1 Reply Last reply Reply Quote 4
              • J Offline
                Jopyth Moderator @MichMich
                last edited by Jopyth

                @MichMich Did you have any concerns about making this an opt-out instead of an opt-in? I.e. make the default options {this.identifier} instead of {}. Or is there a specific reason against it? The overall concept seems reasonable, if we assume the meaning of the hide() method always was to “keep this module hidden until I want it to reappear”.

                I do not think anyone does something like hiding module A from module B and then purposely showing module A again from module C. This is the only way I think of, which would make the default option using the modules identifier weird.

                Helpful sticky: How to troubleshoot

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

                  @Jopyth one way would be hide a module with the scheduler and show it again with the remote control or voice or something else

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

                  1 Reply Last reply Reply Quote 1
                  • MichMichM Offline
                    MichMich Admin
                    last edited by

                    @Jopyth: The problem is that there is no way to find out which module requested the hide method. Therefor I can’t use that identifier by default. This must be provided by the module itself.

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      Jopyth Moderator
                      last edited by

                      Oh, I see. My this.identifier would have been the identifier of the module to be hidden.

                      Helpful sticky: How to troubleshoot

                      MichMichM 1 Reply Last reply Reply Quote 0
                      • MichMichM Offline
                        MichMich Admin @Jopyth
                        last edited by

                        @Jopyth exactly. Wich wouldn’t make much sense.

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        • 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