The order of steps in the time function should be adjusted for a few reasons:
The grapheme is erased, then the next grapheme is obtained and printed. During the first run, the time spent here is significant, so there can be a blank spot between frames. This might be easier to address when cursor positions are used.
It is best to clean up the final grapheme somewhere inside the timer so that a try...catch...finally...end block can be used. That way, no matter how the spinner is exited, the clean up step occurs. This might take some planning, since we need to guarantee that the finally...end block does not occur prematurely.
Note that Timers might or might not execute their function an additional time once they elapse. So, I think we can't rely on the doit function to handle clean up. For instance, it could take! a stop signal, then execute once more after the signal has been removed. On the other hand, it could fetch the stop signal, leaving it for the next cycle, but then it would need to be cleared for the next spinner.
The order of steps in the time function should be adjusted for a few reasons:
try...catch...finally...end
block can be used. That way, no matter how the spinner is exited, the clean up step occurs. This might take some planning, since we need to guarantee that thefinally...end
block does not occur prematurely.Timers
might or might not execute their function an additional time once they elapse. So, I think we can't rely on thedoit
function to handle clean up. For instance, it couldtake!
a stop signal, then execute once more after the signal has been removed. On the other hand, it couldfetch
the stop signal, leaving it for the next cycle, but then it would need to be cleared for the next spinner.