I'm building an app for the Pebble watch using Pebble.js in cloudpebble.
When I look at the Javascript tips & tricks there is a really big heading that says:
Do not use
setInterval()
. And of course, do not usesetTimeout()
to simulate intervals.
As an alternative.. It does say
If you need some function to run at regular intervals, set a timer on Pebble and send a message to the JavaScript. If the JavaScript is dead, the mobile app will re-initialize it and run the message handler.
But I can't find any way to do this with pure javascript
Do you guys have any experience with this?