• Debounces the given value with the specified delay.

    Type Parameters

    • T extends unknown = Value

    Parameters

    • value: T

      The value to be debounced.

    • delay: number

      The delay in milliseconds before invoking the debounced value.

    • Optionaloptions: {
          equalityFn?: (left: T, right: T) => boolean;
          leading?: boolean;
          maxWait?: number;
          trailing?: boolean;
      }

      The optional configuration options for debounce behavior.

      • OptionalequalityFn?: (left: T, right: T) => boolean

        The custom equality function to compare previous and current values.

      • Optionalleading?: boolean

        Determines if the debounced value should be invoked on the leading edge.

      • OptionalmaxWait?: number

        The maximum wait time in milliseconds before invoking the debounced value.

      • Optionaltrailing?: boolean

        Determines if the debounced value should be invoked on the trailing edge.

    Returns [T, DebouncedControlFunctions]

    An array containing the debounced value and control functions for the debounced callback.