Read the statement by Michael Teeuw here.
Module Update Question
-
I apologize in advance for the ignorance.
When building a module, how do I periodically update a variable? For example, let’s say I have a variable that is an array or list of files found on a share. I have to fetch the list on start, how do I tell it to do it again in 10 minutes in case there has been a change?
-
@oldrocker In JavaScript there are two timing functions
setTimeout
and
setIntervalboth take a function to call
and numbers of milliseconds before calling the functiontimeout calls once
interval calls over and overeach returns an if that can be used to cancel the time function
-
Ok, that helps a little. I’ll try some things with setInterval and come back again when I’m stuck. I see a lot of examples where updateDom is included in the setInterval. That just updates the config if necessary, correct?
-
@sdetweil I did it.
Thanks for the help!
-
@oldrocker the call to updateDom() tells MM runtime that your module has new/updated content, and the MM runtime will call your getDom() method to get that ‘new’ content to replace what is already displayed.
-
@sdetweil If I understand you correctly, the call to the Dom is for the visual content update and not necessary after updating data the running module relies on unless that data is to be immediately displayed.
-
@oldrocker correct,… only for visual content change… MM doesn’t know anything else the modules does…