Replies: 3 comments 2 replies
-
|
That's an interesting idea. We're open for PRs, if you want to provide such a primitive. |
Beta Was this translation helpful? Give feedback.
-
|
So if I understand correctly. |
Beta Was this translation helpful? Give feedback.
-
|
Opened #824 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Right now, the
rafprimitives don't allow a way to schedule multiple requests on the same animation frame (as multiple requests on animation frames can be scheduled for different frames and don't always guarantee scheduling at the same time).The proposal would be to add a simple way to handle a frameloop, where you can schedule callbacks that run in a guaranteed batch.
This could be achieved (and is achievable now in userland) by:
Map<string, FrameCallback>)..setand.deletemethods. Some other nice to haves could be provided with this interface, like an option to automatically run whenever there's at least a single framecallback stored and stopped when no callbacks are there.An alternative to this would be providing the
schedule/cancellogic so an external frameloop can be used with this primitive (I think if that's the chosen path, a good rule of thumb would be separating it into another primitive that's more specific for that use case).These considerations come from
motion'sframeutil or articles like this one (probably don't need to add the whole thing to the library, just a way to encourage the single frameloop practice instead of multiple scatteredrequestAnimationFramecalls).Beta Was this translation helpful? Give feedback.
All reactions