Read the statement by Michael Teeuw here.
Refresh Hello World module
-
I am using the Hello World module to display an iFrame on my Magic Mirror. Now I need to refresh the frame every minute, but its not working and my js skills are not really good. It only needs to refresh this:
Thanks for every help!Module.register(“helloworld”,{
// Default module config. defaults: { text: "Hello World!" }, // Override dom generator. getDom: function() { var wrapper = document.createElement("div"); wrapper.innerHTML = this.config.text; return wrapper; }});
-
Hi,
simplest way is to create a new module. So you don’t run into update problems in the future if someone changes the original hello world module.
Copy the whole helloworld folder from modules/default/ to modules/ and rename it to something different, lets say “mmm-iframe”.
- Rename the folder itself to
mmm-iframe - Rename the
helloworld.jsfile tommm-iframe.js
Then overwrite the content of
mmm-iframe.jswith this:/* global Module */ /* Magic Mirror * Module: mmm-iframe * * By Michael Teeuw http://michaelteeuw.nl * MIT Licensed. */ Module.register("mmm-iframe",{ // Default module config. defaults: { text: "Hello World!", animationSpeed: 1000, }, start: function() { Log.info('Starting module: ' + this.name); var self = this; setInterval(function() { self.updateDom(); }, this.config.animationSpeed); }, // Override dom generator. getDom: function() { var wrapper = document.createElement("div"); wrapper.innerHTML = this.config.text; return wrapper; } });- Now update your config file and replace the helloworld entry to load the mmm-iframe module instead.
I did not test this, I don’t have a magicmirror available currently, but this should get you going.
- Rename the folder itself to
-
Thanks for your answer,
I think there is a problem with the MMM-ModuleScheduler. When the frame is hidden your version is refreshing good, but when it is visible, it is stopping. Maybe it will not work together…
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login