UNPKG

@adaptabletools/adaptable-cjs

Version:

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

18 lines (17 loc) 683 B
/** * Creates a throttled function that only invokes func at most once per * every wait milliseconds. The throttled function comes with a cancel * method to cancel delayed func invocations and a flush method to * immediately invoke them. * * Supports options: { leading, trailing } * Drop-in replacement for lodash/throttle. * * Implemented using debounce with maxWait (same approach as lodash). */ import { DebouncedFunction } from './debounce'; export interface ThrottleOptions { leading?: boolean; trailing?: boolean; } export default function throttle<T extends (...args: any[]) => any>(func: T, wait?: number, options?: ThrottleOptions): DebouncedFunction<T>;