Skip to content
On this page

Debounce

Enter the debounce mode by setting options.debounceWait. At this time, if run or runAsync is triggered frequently, the request will be executed with the debounce strategy.

Code demonstration

Options

The usage and effect of all debounce property are the same as lodash.debounce

PropertyDescriptionTypeDefault Value
debounceWaitDebounce delay time, in milliseconds. After setting, enter the debounce modenumber-
debounceLeadingExecute the request before the delay startsboolean|Ref<boolean>false
debounceTrailingExecute the request after the delay endsboolean|Ref<boolean>true
debounceMaxWaitThe maximum time request is allowed to be delayed before it’s executednumber|Ref<number>-

Remark

  • options.debounceLeading support dynamic changes.
  • options.debounceTrailing support dynamic changes.
  • options.debounceMaxWait support dynamic changes.
  • runAsync will return a Promise when it is actually executed. When it is not executed, there will be no return.
  • cancel can abort a function waiting to be executed.

Source

SourceDocsDemo