Closed Thaina closed 5 years ago
I’m afraid I don’t really follow what you’re asking for. Running code on a requestAnimationFrame callback would still be on the main UI thread.
Are you able to specify more precisely what you’re looking for? Note that we’ve already designed rendering to work in the way that we think is most useful, so realistically would only change it if given very specific justifications.
@SteveSandersonMS Surely it would be the same thread but it would like subthread that not always called unnecessary, only when the browser need to repaint, that's what requestAnimationFrame
used for
Suppose we have a loop timer that changing whole table. It could be triggered faster than the browser's repaint. This leads to unnecessary command trying to change the DOM of that table more than it really be painted. With requestAnimationFrame
we could separate timer updating data to run from the logic to generate table only when it really repaint
requestAnimationFrame
was recommended to be used from canvas to css, everything relate to graphic in browser. So I think framework like blazor should utilize it
I think your rendering system would be the same with running on the main thread directly or under requestAnimationFrame
, it just requestAnimationFrame
is better be used for everything related to rendering
requestAnimationFrame
is the pattern to queue deferred actions when you are doing animation. By having this supported, I think animations would not need (that much) JS interop.
It would be nice to see some Blazor animation experiment to see what does Blazor need to support fluent animation or components/elements.
This is not something we're planning to change in this release.
I would like to propose interface or virtual function that wrap around
requestAnimationFrame
functionBecause
requestAnimationFrame
should be called only once at a time and triggered only when any data was changed. So it would be great if the framework would wrap and manage this function instead of us using it directlyIt could be that we would have interface contain
void OnRender()
. And whenever the data was changed it would trigger therequestAnimationFrame
to call allOnRender
in the listIf possible, I think every component should run on this render callback instead of the main thread