is there an equivalent jscex method of clearInterval?
Closed this issue · 3 comments
I'm trying to use jscex in an animation lib, this lib rely heavily on setInterval and clearInterval, I found that jscex compile await/sleep methods to setTimeout instead of setInterval, this there an equivalent jscex method of clearInterval?
an example of clearInterval
A task in "Jscex" means "an operation would be finished in the future", but "setInterval" means "execute over and over (forever)", so there's no equivalent in Jscex method.
Would you like to show me some details of your secenario so we can work out how Jscex may fit in your requirement.
Thanks, the first example of jscex readme file is setInterval, which confused me. I should to use setTimeout with loop to simulate, right?
I posted a setInterval example code to gist: https://gist.github.com/975794
it's a code snippet mod of draw clock example ( http://files.zhaojie.me/demos/jscex/samples/async/clock.html )
Hope it helps: https://gist.github.com/976066
Actually it seems setInterval is not as widely used as setTimeout. If you're going to find something like setInterval, just use an infinite loop - e.g., while(true) - in the Jscex function.