1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports.default = useDebouncedCallback;
|
5 | var _react = require("react");
|
6 | var _useTimeout = _interopRequireDefault(require("./useTimeout"));
|
7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | function useDebouncedCallback(fn, delay) {
|
16 | const timeout = (0, _useTimeout.default)();
|
17 | return (0, _react.useCallback)((...args) => {
|
18 | timeout.set(() => {
|
19 | fn(...args);
|
20 | }, delay);
|
21 | }, [fn, delay]);
|
22 | } |
\ | No newline at end of file |