Skip to content

Add (minimal) bindings to resizeObserver#72

Open
panglesd wants to merge 3 commits into
dbuenzli:masterfrom
panglesd:resize-observer
Open

Add (minimal) bindings to resizeObserver#72
panglesd wants to merge 3 commits into
dbuenzli:masterfrom
panglesd:resize-observer

Conversation

@panglesd

Copy link
Copy Markdown
Contributor

This adds bindings to the ResizeObserver API.
For now, only target can be extracted from entries, but that is a first step.

@dbuenzli

Copy link
Copy Markdown
Owner

I have a bunch of ad-hoc bindings to these in various projects (e.g. here and there) so I want to have relook at them first, but that won't happen immediately. Also if we add support for it, it should be mentioned here.

@dbuenzli

Copy link
Copy Markdown
Owner

Now that you spelled it out, I realize I actually never bound ResizeObserver but MutationObserver and IntersectionObserver.

@dbuenzli

dbuenzli commented Jul 21, 2025

Copy link
Copy Markdown
Owner

Sorry @panglesd but I'm not going to merge that for the next release.

I think a common strategy should be adopted for all these Observer APIs. But since they are performance sensitive, I'm not sure the API you gave here is the most appropriate (that is converting the array of entries to a list).

@dbuenzli

Copy link
Copy Markdown
Owner

I don't have the time to think about now but just so that I don't forget. I think it's likely better to pass in a fold function (instead of converting the array to a list). This pattern is already used in a few other places for dealing with the iterator protocol and most recently in the Regexp.Result module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants