Re: The need to re-subscribe to requestAnimationFrame

Without having used it too much, I'd say it is because of the following:

Imagine that you have a callback that does a lot of heavy rendering and the
rAF returns AGAIN while "// do stuff".  Then you'd all of a sudden have an
accumulating list of "do stuff'ers" that run in parallel - eating away CPU.

There is no need to ask for the next available "paint slot" until the
previous work is cleared out of the way.

Correct me if I am wrong.

- Lars


On Sat, Mar 2, 2013 at 12:03 PM, David Bruant <bruant.d@gmail.com> wrote:

> Hi,
>
> If someone wants to reuse the same function for requestionAnimationFrame,
> he/she has to go through:
>     requestAnimationFrame(function f(){
>         requestAnimationFrame(f);
>         // do stuff
>     })
>
> I was wondering why it was the case. Other event-like mechanism do not
> require to re-subscribe after an event happened.
>
> Thanks,
>
> David
>
>

Received on Saturday, 2 March 2013 11:46:15 UTC