06-21-2021 17:38
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-21-2021 17:38
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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

06-21-2021 17:44
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


06-21-2021 17:44
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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.
Gondwana Software

06-22-2021 06:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-22-2021 06:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Is there any type of "when" code?
let hours = today.getHours();
when(hours = 24) {
//Run Function
}

06-24-2021 07:16
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


06-24-2021 07:16
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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.

