import { action, makeObservable, observable } from 'mobx';
export class ResizeObserverState {
    constructor() {
        this.contentRect = null;
        makeObservable(this, {
            contentRect: observable.ref,
        });
    }
    init({ target }) {
        if (target == null || typeof ResizeObserver === 'undefined') {
            return;
        }
        const resizeObserver = new ResizeObserver(action(([{ contentRect }]) => {
            this.contentRect = {
                height: contentRect.height,
            };
        }));
        resizeObserver.observe(target);
        return () => {
            resizeObserver.disconnect();
        };
    }
}
//# sourceMappingURL=ResizeObserverState.js.map