Skip to main content

debounce

FitFileViewer - API Documentation v29.4.0


FitFileViewer - API Documentation / utils/app/performance/performanceUtils / debounce

Function: debounce()

debounce<T>(func: T, wait: number, options?: { leading?: boolean; trailing?: boolean; }): T & { cancel: () => void; flush: () => void; }

Defined in: utils/app/performance/performanceUtils.js:64

Debounce a function

Type Parameters​

T​

T extends (...args: any[]) => any

Parameters​

func​

T

Function to debounce

wait​

number

Wait time in milliseconds

options?​

Options

leading?​

boolean

Execute on leading edge

trailing?​

boolean

Execute on trailing edge

Returns​

T & { cancel: () => void; flush: () => void; }

Debounced function with cancel and flush methods