Read the statement by Michael Teeuw here.
Delay a module from loading?
-
@wizz the modules get loaded in the order you put them in the config ;)
-
@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.
-
@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
-
@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. -
@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.
-
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; } });