Documents for @litert/utils-async
    Preparing search index...

    Class PromiseController<T, TError>

    The controller for promises, which allows you to decouple the resolver/rejecter with the promise object.

    Type Parameters

    • T = unknown
    • TError = unknown
    Index

    Constructors

    Properties

    Constructors

    Properties

    promise: Promise<T>

    The promise object that is controlled by this controller.

    REMEMBER: ALWAYS CATCH THE REJECTION OF THE PROMISE!

    reject: IPromiseRejecter<TError>

    The rejecter function for the promise, which can be used to turn the promise object into the REJECTED state.

    Because of the feature of the promises, calling this method multiple times or after called resolve method, will not change the state of the promise.

    resolve: IPromiseResolver<T>

    The resolver function for the promise, which can be used to turn the promise object into the RESOLVED state.

    Because of the feature of the promises, calling this method multiple times or after called reject method, will not change the state of the promise.