Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.disconnect() method and constructor structure #15

Open
bilgin1500 opened this issue Mar 13, 2019 · 1 comment
Open

.disconnect() method and constructor structure #15

bilgin1500 opened this issue Mar 13, 2019 · 1 comment

Comments

@bilgin1500
Copy link

Thanks for the hook implementation.

A concern about disconnect method: MDN docs say that the disconnect method doesn't receive any parameters, it rather disconnects all the connected observers.

A question about the constructor: I think the code creates a new constructor every time a new ref is given. Please correct me if I'm wrong, but given the fact that we always use the same handleResize callback, shouldn't we use a single global ResizeObserver reference?

@osdiab
Copy link

osdiab commented Mar 4, 2020

I think you mean a new instance of ResizeObserver, not a new constructor - this isn't calling disconnect() on the global ResizeObserver constructor, but rather a local resizeObserver instance. With that in mind I think the code is fine as is, because it's only disconnecting for that particular resize observer instance, not globally across all registered resize observers.

But I'm not expert in ResizeObserver so idk, but if that's the case this can be closed

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

No branches or pull requests

2 participants