brr icon indicating copy to clipboard operation
brr copied to clipboard

Add (minimal) bindings to `resizeObserver`

Open panglesd opened this issue 1 year ago • 4 comments

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

panglesd avatar Feb 27 '25 15:02 panglesd

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 avatar Feb 27 '25 16:02 dbuenzli

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

dbuenzli avatar Feb 28 '25 14:02 dbuenzli

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 avatar Jul 21 '25 19:07 dbuenzli

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.

dbuenzli avatar Jul 25 '25 08:07 dbuenzli