@@ -42,23 +42,31 @@ throttled value
42
42
<td>The number of milliseconds to throttle invocations to.</td>
43
43
</tr >
44
44
<tr >
45
- <td rowspan="1 ">options</td>
45
+ <td rowspan="2 ">options</td>
46
46
<td>leading</td>
47
47
<td>boolean</td>
48
48
<td>-</td>
49
49
<td>Specify invoking on the leading edge of the timeout.</td>
50
50
</tr >
51
+ <tr >
52
+ <td>customizer</td>
53
+ <td>function</td>
54
+ <td>-</td>
55
+ <td>The function to customize comparisons.</td>
56
+ </tr >
51
57
</table >
52
58
53
- | return | type | explain |
54
- | ------ | ---- | -------------------------------- |
55
- | value | any | Returns the new throttled value. |
59
+ | return | type | explain |
60
+ | ----------- | -------- | -------------------------------- |
61
+ | value | any | Returns the new throttled value. |
62
+ | cancel | function | The clear timer function. |
63
+ | callPending | function | The callback manually function. |
56
64
57
65
``` tsx
58
66
import { useThrottle } from " @react-cmpt/use-throttle" ;
59
67
60
68
const Demo = ({ value }) => {
61
- const tValue = useThrottle (value , 200 );
69
+ const [ tValue, { cancel, callPending }] = useThrottle (value , 200 );
62
70
63
71
// ...
64
72
};
@@ -106,7 +114,7 @@ throttled function
106
114
import { useThrottleFn } from " @react-cmpt/use-throttle" ;
107
115
108
116
const Demo = () => {
109
- const { callback, cancel } = useThrottleFn (() => {
117
+ const { callback, cancel, callPending } = useThrottleFn (() => {
110
118
console .log (" click" );
111
119
}, 200 );
112
120
0 commit comments