Throttle
useRequest It provides a options.throttleWait parameter into throttling mode, and if the run or the runAsync is frequently triggered, the request is made by throttling policy.
Basic usage
Options
The usage and effects of all throttle property are the same as lodash.throttle
| Property | Description | Type | Default Value |
|---|---|---|---|
| throttleWait | Throttle wait time, in milliseconds. After setting, enter the throttle mode | number | - |
| throttleLeading | Execute the request before throttling starts | boolean|Ref<boolean> | true |
| throttleTrailing | Execute the request after throttling ends | boolean|Ref<boolean> | true |
Remark
options.throttleWaitsupport dynamic changes.options.throttleLeadingsupport dynamic changes.options.throttleTrailingsupport dynamic changes.runAsyncwill return aPromisewhen it is actually executed. When it is not executed, there will be no return.cancelcan abort a function waiting to be executed.