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.

    Delay a module from loading?

    Scheduled Pinned Locked Moved Troubleshooting
    7 Posts 3 Posters 3.5k Views 3 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.
    • W Offline
      wizz
      last edited by

      The problem i got is that i need all my modules to load befor i load the Ifram module as i want it to load last and not when the rest is loading.
      As in the iFrame i got a live stream that auto plays when the Ifram module is loading and i want to save power for that as it is now all hangs when loading.

      Hope for an solution.

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

        @wizz the modules get loaded in the order you put them in the config ;)

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

        1 Reply Last reply Reply Quote 0
        • W Offline
          wizz
          last edited by

          @strawberry-3-141 That i know but i want it to be delayed as it is a live stream that loads and plays on auto.
          So i rely need it as it is consuming cpu power when it loads and than the result is that my RPI hangs and needs to restart.

          Or if it is any function / Module so i can manage the stream by a mouse click or other as i can delete the line that turns the stream on automatically.

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

            @wizz you could enhance the start function with a timeout which sets a flag delayload and calls the updatedom function, then in getdom you check if the delayload flag is set, if so then render the iframe

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

            A 1 Reply Last reply Reply Quote 0
            • W Offline
              wizz
              last edited by

              @strawberry-3-141 Thanks for your help and for all support.
              I rely like the solution and all works fine.
              So again many thanks for your help.

              1 Reply Last reply Reply Quote 0
              • A Offline
                Advokaten @strawberry 3.141
                last edited by

                @strawberry-3.141 would you happen to sit on an example of this sorcery you speak of? I’m looking to add a delay to my newsfeed, as I have 3 different feeds, and it’s quite disorienting when all 3 reload at the same time.

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

                  @Advokaten

                  Module.register("iFrame",{
                    // Default module config.
                    defaults: {
                      height:"300px",
                      width:"100%"
                    },
                  
                    start: function(){
                      setTimeout(() => {this.delayLoad = true; this.updateDom();}, 2 * 60 * 1000);
                    },
                  
                    // Override dom generator.
                    getDom: function() {
                      var iframe = document.createElement("IFRAME");
                  
                      if(this.delayLoad){
                        iframe.style = "border:0";
                        iframe.width = this.config.width;
                        iframe.height = this.config.height;
                        iframe.src = this.config.url;
                      }
                      return iframe;
                    }
                  });
                  

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

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