API Reference
@univerjs
@univerjs/core
functions
Debounce

@univerjs/core v0.4.2Docs


Function: debounce()

debounce(func, wait, options)

function debounce<T>(
   func, 
   wait, 
options): DebouncedFuncLeading<T>

Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since the last time the debounced function was invoked. The debounced function comes with a cancel method to cancel delayed invocations and a flush method to immediately invoke them. Provide an options object to indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls to the debounced function return the result of the last func invocation.

Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if the the debounced function is invoked more than once during the wait timeout.

See David Corbacho’s article for details over the differences between _.debounce and _.throttle.

Type Parameters

Type Parameter
T extends (...args) => any

Parameters

ParameterTypeDescription
funcTThe function to debounce.
waitundefined | numberThe number of milliseconds to delay.
optionsDebounceSettingsLeadingThe options object.

Returns

DebouncedFuncLeading<T>

Returns the new debounced function.

Defined in

submodules/univer/node_modules/.pnpm/@types+lodash@4.17.7/node_modules/@types/lodash/common/function.d.ts:425

debounce(func, wait, options)

function debounce<T>(
   func, 
   wait?, 
options?): DebouncedFunc<T>

Type Parameters

Type Parameter
T extends (...args) => any

Parameters

ParameterType
funcT
wait?number
options?DebounceSettings

Returns

DebouncedFunc<T>

Defined in

submodules/univer/node_modules/.pnpm/@types+lodash@4.17.7/node_modules/@types/lodash/common/function.d.ts:426


Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.