4

So reading through the MDN docs on requestAnimationFrame and I see that when you fire the function you are returned an integer ID for the entry and that you can use that ID to later cancel the request similar to intervals and timeouts.

I also know you can use the function multiple times to create multiple request entities.

My question is: is there a way to see all of the requested entities in the browser session?

I know I can push each of the ids onto an array and use that to track and manage the requests, but is there a native way to see all of the requests in the browser without having to roll my own list? Considering the typical pattern for requestAnimationFrame for things like Three.js is something like:

function animate() {
    requestAnimationFrame(animate)
}
requestAnimationFrame(this.animate)

It seems like it would be beneficial to be able to check and see the list of requests actually made.

Chris Schmitz
  • 20,160
  • 30
  • 81
  • 137

1 Answers1

3

I'm afraid there's no native way, currently. Neither the WHATWG Living Standard section for animation frames nor the W3C spec mention anything beyond requestAnimationFrame() and cancelAnimationFrame(). The browser is definitely supposed to keep a list of animation frame callbacks, but I see no way to access it.

Andrew Myers
  • 2,754
  • 5
  • 32
  • 40
  • Ok cool. I dug through all of the docs I could find but couldn't see a way of doing it so I wanted to check to make sure I wasn't missing something. Thanks for confirming! – Chris Schmitz May 31 '18 at 00:03