main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
348 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import { useEffect } from 'react';
|
---|
| 2 | import useTimeoutFn from './useTimeoutFn';
|
---|
| 3 | export default function useDebounce(fn, ms, deps) {
|
---|
| 4 | if (ms === void 0) { ms = 0; }
|
---|
| 5 | if (deps === void 0) { deps = []; }
|
---|
| 6 | var _a = useTimeoutFn(fn, ms), isReady = _a[0], cancel = _a[1], reset = _a[2];
|
---|
| 7 | useEffect(reset, deps);
|
---|
| 8 | return [isReady, cancel];
|
---|
| 9 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.