UNPKG

typedash

Version:

modern, type-safe collection of utility functions

33 lines (32 loc) 1.28 kB
import { t as AnyFunction } from "./AnyFunction-C6KudB8p.cjs"; //#region src/functions/throttle/throttle.d.ts interface ThrottleOptions { /** * Specify invoking on the leading edge of the timeout. * @default true */ leading?: boolean; /** * Specify invoking on the trailing edge of the timeout. * @default true */ trailing?: boolean; } /** * Creates a throttled function that limits the rate at which it can be called. * @param func The function to be throttled. * @param wait The number of milliseconds to wait between each invocation of the function. * @param options The options for the throttling behavior. * @param options.leading Whether to call the function on the leading edge of the timeout. * @param options.trailing Whether to call the function on the trailing edge of the timeout. * @returns The throttled function with `cancel` and `flush` methods. */ declare function throttle<TFunction extends AnyFunction>(func: TFunction, wait?: number, options?: ThrottleOptions): ThrottledFunction<TFunction>; interface ThrottledFunction<TFunction extends AnyFunction> { (...args: Parameters<TFunction>): void; cancel: () => void; flush: () => void; } //#endregion export { throttle as t }; //# sourceMappingURL=throttle-BR4ty22d.d.cts.map