Fitbit Product Experts Alumni are retired members of the Fitbit Product Expert Program. Learn more
Can anyone explain how the setInterval works in the following conditions.
In a clock app issue a setInterval - then switch to another app, Today or exercise.
Return to the original app some time after the interval has expired.
What happens to the interval, is it lost, does it hang around, will it trigger the original app in some way even though another app is running at the time? Does it do anything else? Does one have to remove it, even though it passed? Any other special considerations?
Without a full understanding its not possible to determine if it could be causing problems.
Thanks
Author | ch, passion for improvement.
Answered! Go to the Best Answer.
Best AnswerI don't think your question is really about setInterval. It's about how JavaScript runs on the watch. When another app is started, your clockface is closed (ie, killed, not just invisible). That means all JavaScript 'state' associated with it (eg, variables and intervals) is lost. The only thing retained is any info you've written to the file system.
When your clockface resumes, it's like starting again for the first time (except that it could load info from the file system if it placed any there previously).
Best AnswerI don't think your question is really about setInterval. It's about how JavaScript runs on the watch. When another app is started, your clockface is closed (ie, killed, not just invisible). That means all JavaScript 'state' associated with it (eg, variables and intervals) is lost. The only thing retained is any info you've written to the file system.
When your clockface resumes, it's like starting again for the first time (except that it could load info from the file system if it placed any there previously).
Best Answer
Fitbit Product Experts Alumni are retired members of the Fitbit Product Expert Program. Learn more