06-21-2021 17:38
06-21-2021 17:38
I want a function to run every day for a clockface. How do I do this?
For example, generate a random number every day.
Thanks,
Techninja
Best Answer06-21-2021 17:44
Gold Fitbit Product Experts share support knowledge on the forums and advocate for the betterment of Fitbit products and services. Learn more
06-21-2021 17:44
Keep track of the date you last ran the function. If the current date is different from that, run the function (which should update the dateLastRun variable).
You may need to save the variable to the file system if you don't want it to get lost when your clockface closes.
Best Answer06-22-2021 06:33
06-22-2021 06:33
Is there any type of "when" code?
let hours = today.getHours();
when(hours = 24) {
//Run Function
}
Best Answer06-24-2021 07:16
Fitbit Product Experts Alumni are retired members of the Fitbit Product Expert Program. Learn more
06-24-2021 07:16
You can use setInterval() to make something happen at a specific time from now. Up to you to set when that is from now.
Author | ch, passion for improvement.
Best Answer