Skip to content

Conversation

@karlseguin
Copy link
Collaborator

@karlseguin karlseguin commented Jun 5, 2025

This is often called in a tight loop (the callback to requestAnimation typically calls requestAnimation).

As-is, it can result in the browser locking due to the requestAnimation callback calling requestAnimation. (I can reproduce this blocking in some cases. I'm not sure why it doesn't always block if it calls itself.).

Instead, we can treat it like a setTimeout with a short delay (5ms ?). This has the added benefit of making it cancelable, FWIW.

This is often called in a tight loop (the callback to requestAnimation typically
calls requestAnimation).

Instead, we can treat it like a setTimeout with a short delay (5ms ?). This has
the added benefit of making it cancelable, FWIW.
@karlseguin karlseguin merged commit e77d888 into main Jun 6, 2025
11 checks passed
@karlseguin karlseguin deleted the slow_down_animation_frame branch June 6, 2025 05:22
@github-actions github-actions bot locked and limited conversation to collaborators Jun 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants