1.0.4 • Published 5 years ago
@jsxtools/resize-observer v1.0.4
resize-observer
resize-observer is a minimal polyfill for the ResizeObserver API, following the Resize Observer Specification.
It is 1946 bytes (852 gzipped).
Installation
npm install @jsxtools/resize-observer
Usage
import polyfillResizeObserver from '@jsxtools/resize-observer'
// polyfill ResizeObserver
window.ResizeObserver || polyfillResizeObserver(window)
import polyfillResizeObserver from '@jsxtools/resize-observer'
// ponyfill ResizeObserver
const { ResizeObserver, ResizeObserverEntry, DOMRectReadOnly } = polyfillResizeObserver({})
Acknowledgments
The algorithms used to calculate the dimensions of an element follow the excellent resize-observer project authored by Tremayne Christ. That polyfill is a small, performant, and more complete polyfill that follows the latest draft specification.