@appello/common
Version:
Common package with many useful features for web and mobile development
13 lines (12 loc) • 391 B
TypeScript
import { AnyFunction } from '../../types';
export type ThrottleOptions = {
leading?: boolean;
trailing?: boolean;
maxWait?: number;
};
export declare function throttle<T extends AnyFunction>(func: T, wait?: number, options?: ThrottleOptions): {
(...args: Parameters<T>): ReturnType<T> | undefined;
cancel: () => void;
flush: () => any;
pending: () => boolean;
};