Function debounce

  • Type Parameters

    • Args extends unknown[]

    • Result

    Parameters

    • fn: ((...args) => Result)
    • Optional timeout: number
    • Optional edge: "leading" | "both"

    Returns ((...args) => Result)

  • Type Parameters

    • Args extends unknown[]

    • Result

    Parameters

    • fn: ((...args) => Result)
    • Optional timeout: number
    • Optional edge: "trailing"

    Returns ((...args) => Result)

  • Type Parameters

    • Args extends unknown[]

    • Result

    Parameters

    • fn: ((...args) => Result)
    • Optional timeout: number
    • Optional edge: "trailingPromise"

    Returns ((...args) => Promise<Result>)