function progress()
{
if(activity === "session")
{
clock = sessionClock();
}
else
{
clock = breakClock();
}
clock.animate(1.0, function(){ //Callback
clock.destroy();
activity = (activity === "session"?"break":"session");
progress(); //Call Progress again.
});
}
I’ve created two functions(sessionClock and breakClock) to return two clocks one for ‘session’, one for ‘break’.
Once one of the clocks completes, i destroy it and call the progress() function in the callback function of the clock.animate.
It repeats forever, toggling between session and break calling progress() each time.
My question is,
is this code efiicient? will progress() be added to function call stack each time?
i used progressBar.js http://progressbarjs.readthedocs.io/en/latest/api/shape/#animateprogress-options-cb