UNPKG

@adaptabletools/adaptable-cjs

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

13 lines (12 loc) 475 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useGlobalEvent = void 0; const tslib_1 = require("tslib"); const React = tslib_1.__importStar(require("react")); const useGlobalEvent = (eventName, callback) => { React.useEffect(() => { window.addEventListener(eventName, callback); return () => window.removeEventListener(eventName, callback); }, [eventName, callback]); }; exports.useGlobalEvent = useGlobalEvent;