• Creates a debounced function that delays invoking the provided function until after the specified wait time has elapsed since the last time the debounced function was invoked.

    Type Parameters

    • T extends ((...args) => void)

    Parameters

    • func: T

      The function to debounce.

    • wait: number

      The number of milliseconds to delay.

    • immediate: boolean = false

      If true, trigger the function on the leading edge instead of the trailing.

    Returns ((...args) => void)

    A new debounced function.

      • (...args): void
      • Parameters

        • Rest ...args: Parameters<T>

        Returns void