Re: [csswg-drafts] [resize-observer] why we need `ResizeObserver.takeRecords()` or `ResizeObserver.hasRecords()` (the canvas flickering problem) (#9717)

My primary use case for ResizeObserver + requestAnimationFrame has always been to update WebGL or Canvas drawings based on changes in the DOM from 3rd party code.

Because RO callback runs after the rAF callbacks, either my drawing is based on outdated information or I have to draw twice per frame after the ResizeObserver callback updates with the newest info.

It'd be great to either have an option to run RO callbacks before rAF or to have a takeRecords API as described in this thread so I can get updates manually in my rAF.

As far as I can tell, I'd always choose to have RO run before rAF because, if I make changes to my DOM sizes in my rAF code, my code knows about it. RO is uniquely useful because it can detect changes from async or 3rd party code.

-- 
GitHub Notification of comment by StephenHaney
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9717#issuecomment-2504900783 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 27 November 2024 22:27:05 UTC