import React from "react";

//#region src/hooks/useWindowEventListener.ts
const useWindowEventListener = (eventOrEvents, cb) => {
	React.useEffect(() => {
		const events = [eventOrEvents].flat().filter((x) => !!x);
		if (!events.length) return;
		events.forEach((e) => window.addEventListener(e, cb));
		return () => {
			events.forEach((e) => window.removeEventListener(e, cb));
		};
	}, [eventOrEvents, cb]);
};

//#endregion
export { useWindowEventListener };
//# sourceMappingURL=useWindowEventListener.js.map