How to use the resize-observer-polyfill/dist/ResizeObserver 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 adobe / coral-spectrum / coral-utils / src / scripts / Commons.js View on Github external
constructor() {
    // Create a Map to link elements to observe to their resize event callbacks
    this._resizeObserverMap = new Map();
    
    this._resizeObserver = new ResizeObserver((entries) => {
      for (let i = 0; i < entries.length; i++) {
        const observedElement = entries[i].target;
        const allCallbacks = this._resizeObserverMap.get(observedElement);
        if (allCallbacks) {
          for (let j = 0; j < allCallbacks.length; j++) {
            allCallbacks[j].call(observedElement);
          }
        }
      }
    });
    
    const focusableElements = FOCUSABLE_ELEMENTS.slice();
    this._focusableElementsSelector = focusableElements.join(',');
  
    focusableElements.push('[tabindex]:not([tabindex="-1"])');
    this._tabbableElementsSelector = focusableElements.join(':not([tabindex="-1"]),');
github adobe / coral-spectrum / coralui-utils / src / scripts / Commons.js View on Github external
constructor() {
    // Create a Map to link elements to observe to their resize event callbacks
    this._resizeObserverMap = new Map();
    
    this._resizeObserver = new ResizeObserver((entries) => {
      for (let i = 0; i < entries.length; i++) {
        const observedElement = entries[i].target;
        const allCallbacks = this._resizeObserverMap.get(observedElement);
        if (allCallbacks) {
          for (let j = 0; j < allCallbacks.length; j++) {
            allCallbacks[j].call(observedElement);
          }
        }
      }
    });
    
    const focusableElements = FOCUSABLE_ELEMENTS.slice();
    this._focusableElementsSelector = focusableElements.join(',');
  
    focusableElements.push('[tabindex]:not([tabindex="-1"])');
    this._tabbableElementsSelector = focusableElements.join(':not([tabindex="-1"]),');