Skip to content

Commit c6eda4b

Browse files
committed
docs(useThrottle): sync types (options, returns)
1 parent b28fc80 commit c6eda4b

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,31 @@ throttled value
4242
<td>The number of milliseconds to throttle invocations to.</td>
4343
</tr>
4444
<tr>
45-
<td rowspan="1">options</td>
45+
<td rowspan="2">options</td>
4646
<td>leading</td>
4747
<td>boolean</td>
4848
<td>-</td>
4949
<td>Specify invoking on the leading edge of the timeout.</td>
5050
</tr>
51+
<tr>
52+
<td>customizer</td>
53+
<td>function</td>
54+
<td>-</td>
55+
<td>The function to customize comparisons.</td>
56+
</tr>
5157
</table>
5258

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. |
5664

5765
```tsx
5866
import { useThrottle } from "@react-cmpt/use-throttle";
5967

6068
const Demo = ({ value }) => {
61-
const tValue = useThrottle(value, 200);
69+
const [tValue, { cancel, callPending }] = useThrottle(value, 200);
6270

6371
// ...
6472
};
@@ -106,7 +114,7 @@ throttled function
106114
import { useThrottleFn } from "@react-cmpt/use-throttle";
107115

108116
const Demo = () => {
109-
const { callback, cancel } = useThrottleFn(() => {
117+
const { callback, cancel, callPending } = useThrottleFn(() => {
110118
console.log("click");
111119
}, 200);
112120

0 commit comments

Comments
 (0)