Function afterinit

Creates a wrapped function that only executes the provided function after the initial call has completed. The wrapped function can be cleared to allow subsequent calls to execute the provided function again.

  • Type Parameters

    • T extends unknown = any

      The type of the promise resolved by the provided function.

    • P extends any[] = any[]

      The type of the arguments passed to the provided function.

    Parameters

    • run: ((...args: P) => Promise<T>)

      The function to be wrapped.

        • (...args): Promise<T>
        • Parameters

          • Rest...args: P

          Returns Promise<T>

    Returns IWrappedFn<T, P>

    The wrapped function.