UNPKG

@mantine/hooks

Version:

A collection of 50+ hooks for state and UI management

14 lines (13 loc) 508 B
"use client"; let react = require("react"); //#region packages/@mantine/hooks/src/use-window-event/use-window-event.ts function useWindowEvent(type, listener, options) { const stableListener = (0, react.useEffectEvent)(listener); (0, react.useEffect)(() => { window.addEventListener(type, stableListener, options); return () => window.removeEventListener(type, stableListener, options); }, [type]); } //#endregion exports.useWindowEvent = useWindowEvent; //# sourceMappingURL=use-window-event.cjs.map