UNPKG

@dark-engine/core

Version:

The lightweight and powerful UI rendering engine without dependencies and written in TypeScript (Browser, Node.js, Android, iOS, Windows, Linux, macOS)

16 lines (15 loc) 494 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); exports.useEvent = void 0; const use_memo_1 = require('../use-memo'); const use_callback_1 = require('../use-callback'); function useEvent(fn) { const scope = (0, use_memo_1.useMemo)(() => ({ fn }), []); scope.fn = fn; const callback = (0, use_callback_1.useCallback)((...args) => { return scope.fn(...args); }, []); return callback; } exports.useEvent = useEvent; //# sourceMappingURL=use-event.js.map