UNPKG

throttle-typescript

Version:

Helper that returns a throttled function (TypeScript types included - works without TypeScript also)

8 lines (7 loc) 354 B
/** * Call the original function, but applying the throttle rules. * * If the throttled function can be run immediately, this calls it and returns its return * value, otherwise, it returns the return value of the last invocation. */ export declare type ThrottledFunction<T extends (...args: any) => any> = (...args: Parameters<T>) => ReturnType<T>;