Wait for the promise to resolve or reject and then call the finallyFn. If the passed promise argument is not a promise the callback will be called synchronously with the value. If the passed promise doesn't implement finally then a finally implementation will be simulated using then(..., ...).

The value or promise like value to wait for

The finally function to call once the promise has resolved or rejected

  • Wait for the promise to resolve or reject and then call the finallyFn. If the passed promise argument is not a promise the callback will be called synchronously with the value. If the passed promise doesn't implement finally then a finally implementation will be simulated using then(..., ...).

    Type Parameters

    • T

    Parameters

    • value: T | Promise<T>

      The value or promise like value to wait for

    • finallyFn: (() => void)

      The finally function to call once the promise has resolved or rejected

        • (): void
        • Returns void

    Returns T | Promise<T>

  • Wait for the promise to resolve or reject and then call the finallyFn. If the passed promise argument is not a promise the callback will be called synchronously with the value. If the passed promise doesn't implement finally then a finally implementation will be simulated using then(..., ...).

    Type Parameters

    • T

    Parameters

    • value: T | PromiseLike<T>

      The value or promise like value to wait for

    • finallyFn: (() => void)

      The finally function to call once the promise has resolved or rejected

        • (): void
        • Returns void

    Returns T | PromiseLike<T>