Skip to content

allow the usage of a custom resize observer class #66

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

Closed

Conversation

javiergonzalezGenially
Copy link

I'd like to inject a polyfill when window.ResizeObserver is not available. By adding a customResizeObserver optional option I could do:

{
  ...
  customResizeObserver: window.ResizeObserver || resizeObserverPolyfill
}

This PR does that.

@ZeeCoder
Copy link
Owner

ZeeCoder commented Apr 5, 2021

You can simply polyfill your environment prior to including your app code, or do it within your bundler.
See the rollup config I use to create a polyfilled version here.

The quickest solution could also be making a module like this:

import useResizeObserver from 'use-resize-observer';
import resizeObserverPolyfill from 'some-resize-observer-polyfill';


if (!window.ResizeObserver) {
    window.ResizeObserver = resizeObserverPolyfill;
}

export default useResizeObserver;

ZeeCoder added a commit that referenced this pull request Aug 28, 2021
ZeeCoder added a commit that referenced this pull request Aug 28, 2021
ZeeCoder added a commit that referenced this pull request Aug 28, 2021
@ZeeCoder ZeeCoder closed this in fcc0833 Aug 28, 2021
ZeeCoder added a commit that referenced this pull request Aug 28, 2021
@github-actions
Copy link

🎉 This issue has been resolved in version 8.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Repository owner deleted a comment from github-actions bot Aug 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants