MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord
    MagicMirror² v2.20.0 is available! For more information about this release, check out this topic.

    jumping of modules

    Troubleshooting
    3
    23
    9466
    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.
    • K
      kclemen last edited by

      I found why it was not working:

      this.config.defaultClass does not work within the setTimeout. When I change it to "default" which is what is configured in the config.js, then it works perfectly.

      However, I need to use the this.config.defaultClass. So, what would be a solution for this?

      1 Reply Last reply Reply Quote 0
      • K
        kclemen last edited by

        Anyone??

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

          @kclemen

          to keep your scope you need to use a fat arrow (es6) function

          setTimeout(() => {
              MM.getModules().withClass(this.config.defaultClass).exceptWithClass(this.config.everyoneClass).enumerate(function(module) {
                  module.show(1000, function() {
                      Log.log(module.name + ' is hidden.');
                  });
              });
          }, 1000);
          

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

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