sole-resize-observer
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Sole Resize Observer

Installation

Install via NPM.

npm install sole-resize-observer

Information

The recommended pattern is to observe all elements using a single ResizeObserver. This library makes it easier.

import { soleResizeObserver } from "sole-resize-observer";

const callback = ()=>{
	console.log("The element's height is:", element.clientHeight);
}

soleResizeObserver.addListener(element, callback);

soleResizeObserver.removeListener(element, callback)

Like the built-in ResizeObserver, observations are tied to the element's life cycle, thus calling removeListener is usually not necessary.

License

MIT License

All files can be used for commercial or non-commercial purposes. Do not resell. Attribution is appreciated but not due.

Package Sidebar

Install

npm i sole-resize-observer

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

5.17 kB

Total Files

8

Last publish

Collaborators

  • cymaera