@alanscodelog/utils
    Preparing search index...

    Function throttle

    • Returns a throttled function.

      Has all the same options (including debounce queues) as debounce.

      Type Parameters

      Parameters

      • callback: T

        The function to throttle.

      • wait: number = 0

        How long to wait before calling the function can be called again. Defaults to 50

      • __namedParameters: {
            index?: TQueued extends true
                ? number
                | ((...args: Parameters<T>) => number)
                : undefined;
            leading?: boolean;
            promisify?: TPromisify;
            queue?: DebounceQueue | TQueued;
            trailing?: boolean;
        } = {}
        • Optionalindex?: TQueued extends true ? number | ((...args: Parameters<T>) => number) : undefined

          The index number of the argument that will be used as the key to the queues if queues are enabled.

        • Optionalleading?: boolean

          Whether the first call is called immediately. Note that if trailing and leading are both set to true, trailing will only fire if there were multiple calls.

          Defaults to true.

        • Optionalpromisify?: TPromisify

          Whether to promisify the throttled function.

        • Optionalqueue?: DebounceQueue | TQueued

          Whether to use queues, or a queues object to use.

        • Optionaltrailing?: boolean

          Whether the call is delayed until the end of the timeout. Defaults to true.

      Returns Throttled<T, TPromisify>