import { t as debounce } from "./debounce.js";
import { useEffect } from "react";
const useLayoutEvent = (callback, events = [
	"layoutchange",
	"resize",
	"orientationchange"
], debounceMs = 10) => {
	useEffect(() => {
		if (typeof window !== "object") return;
		const [debouncedCallback, teardown] = debounce(callback, debounceMs);
		events.forEach((eventName) => window.addEventListener(eventName, debouncedCallback));
		debouncedCallback();
		return () => {
			teardown();
			events.forEach((eventName) => window.removeEventListener(eventName, debouncedCallback));
		};
	}, []);
};
export { useLayoutEvent as t };

//# sourceMappingURL=useLayoutEvent.js.map