The AsyncWrapper is provided to monitor the state of a promise. You can use this to provide state feedback to the user of an awaitable method.

Type Parameters

  • T

Hierarchy

  • default

Constructors

  • Creates a new unresolved AsyncWrapper

    Type Parameters

    • T

    Returns default<T>

  • Creates a new AsyncWrapper

    Type Parameters

    • T

    Parameters

    • promiseOrValue: Awaitable<T>

      can be a promise or a value

    Returns default<T>

  • Creates a new AsyncWrapper

    Type Parameters

    • T

    Parameters

    • promiseOrValue: Awaitable<T>

      can be a promise or a value

    • callback: ((asyncWrapper) => void)

      the callback that should be applied after the promise is resolved

        • (asyncWrapper): void
        • Parameters

          Returns void

    Returns default<T>

  • Creates a new AsyncWrapper

    Type Parameters

    • T

    Parameters

    • promiseFactory: (() => Awaitable<T>)

      can be a promise or a value factory that will be invoked immediately

    Returns default<T>

  • Creates a new AsyncWrapper

    Type Parameters

    • T

    Parameters

    • promiseFactory: (() => Awaitable<T>)

      can be a promise or a value factory that will be invoked immediately

    • callback: ((asyncWrapper) => void)

      the callback that should be applied after the promise is resolved

        • (asyncWrapper): void
        • Parameters

          Returns void

    Returns default<T>

  • Creates a new AsyncWrapper

    Type Parameters

    • T

    Parameters

    • Optional promiseOrValueOrFactory: Awaitable<T> | (() => Awaitable<T>)

      can be a promise or a value factory, a value or a promise that will be invoked immediately

    • Optional callback: ((asyncWrapper) => void)

      the callback that should be applied after the promise is resolved

        • (asyncWrapper): void
        • Parameters

          Returns void

    Returns default<T>

Properties

#awaitable: Promise<unknown>
#callback: undefined | ((asyncWrapper) => void)

Type declaration

    • (asyncWrapper): void
    • Parameters

      Returns void

#complete: boolean
#completeEvent: default<Undefinable<T>>
#error: unknown
#promise?: Promise<T>
#promiseOrValueOrFactory: undefined | Awaitable<T> | (() => Awaitable<T>)

Type declaration

#success: boolean
#value: Undefinable<T>

Accessors

  • get promise(): Promise<T>
  • Return the internal promise that is waiting for the orginal one to complete

    Returns Promise<T>

Methods

Generated using TypeDoc