type Finishable> = ((...args: A) => void) & {
finish(cancel?: boolean): void;
};
/** returns a throttled function that never runs more often than
* every `delay` milliseconds.
* The returned function also has a nice `.finish()` method.
*/
declare const throttle: {
(func: (...args: A) => void, delay: number, skipFirst?: boolean): Finishable;
/** Sugar to produce a dynamic debounced function that accepts its contents/behavior at call time.
*
* Usage:
*
* const myThrottler = throttle.d(500);
* myThrottler(() => { alert('Hello world'); });
* myThrottler(() => { alert('I mean: Howdy world!'); });
* myThrottler((name) => { alert('Wazzap ' + name); }, 'world');
*/
d(delay: number, skipFirst?: boolean): Finishable<[fn: (...args: any[]) => void, ...args: any[]]>;
};
/** /
const throttler = throttle.d(20, true);
const add = (a: number, b: number) => a * b;
// FIXME: This test should fail!
// $ExpectError
throttler(add, 'a', 'b');
// $ExpectError
throttler('a', 'b');
/**/
export default throttle;