How to use the resize-observer-polyfill.default function in resize-observer-polyfill

To help you get started, we’ve selected a few resize-observer-polyfill examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github benwiley4000 / win95-media-player / src / components / ProgressBar.js View on Github external
componentDidMount() {
    this.resizeObserver = new ResizeObserver(entries => {
      this.setState({
        progressWidth: entries[0].contentRect.width - progressMargin * 2
      });
    });
    this.resizeObserver.observe(this.progressBox);
  }
github geosolutions-it / MapStore2 / web / client / components / misc / enhancers / withResizeSpy.js View on Github external
constructor(props) {
        super(props);
        this.width = undefined;
        this.height = undefined;
        this.skipOnMount = props.skipOnMount;
        this.onResize = debounce((...args) => this.props.onResize(...args), debounceTime !== undefined ? debounceTime : props.debounceTime || 1000);
        this.ro = new ResizeObserver((entries) => {
            entries.forEach((entry) => {
                const { width, height } = entry.contentRect;
                const notifyWidth = this.props.handleWidth && this.width !== width;
                const notifyHeight = this.props.handleHeight && this.height !== height;
                if (!this.skipOnMount && (notifyWidth || notifyHeight)) {
                    this.onResize({width, height});
                }

                this.width = width;
                this.height = height;
                this.skipOnMount = false;
            });
        });
    }
    findDomNode = () => {
github benwiley4000 / win95-media-player / src / components / MediaPlayerView.js View on Github external
componentDidMount() {
    const elem = document.getElementById(this.randomId);
    this.resizeObserver = new ResizeObserver(entries => {
      for (const entry of entries) {
        this.setState({
          width: entry.contentRect.width
        });
      }
    });
    this.resizeObserver.observe(elem);
  }
github ajaxtown / linkcast / dev / src / actions / init.js View on Github external
const observeSizeChanges = () => {
    $bgEle = document.querySelectorAll(".background");
    $container = document.querySelector("#app");
    new ResizeObserver(changeBackgroundSize).observe($container);
};