UNPKG

@adaptabletools/adaptable-cjs

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

21 lines (20 loc) 844 B
/** * 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 func invocations and a flush method to immediately invoke them. * * Supports options: { leading, trailing, maxWait } * Drop-in replacement for lodash/debounce. */ export interface DebounceOptions { leading?: boolean; trailing?: boolean; maxWait?: number; } export interface DebouncedFunction<T extends (...args: any[]) => any> { (...args: Parameters<T>): ReturnType<T> | undefined; cancel(): void; flush(): ReturnType<T> | undefined; } export default function debounce<T extends (...args: any[]) => any>(func: T, wait?: number, options?: DebounceOptions): DebouncedFunction<T>;