Layout Observer watches for a smattering of events and mutations and notifies you when it has detected something that may have affected the layout of a web page (something may have moved or changed size).
npm install --save layout-observer
import LayoutObserver from 'layout-observer';
const observer = new LayoutObserver(() => console.log('layout change'));
observer.observe();
The function passed into the LayoutObserver
constructor will be called each time a change has been detected.
Begins observation.
Ends observation.
Modern browsers. The latest Chrome, Firefox, Safari, and Edge, as well as IE 11+.
iframe-resizer was a fantastic resource for much of the event and mutation detection logic.
MIT