Skip to main content

Deferred <T>

Represents a deferred promise.

Implements

  • Promise<T>

Index

Constructors

publicconstructor

Accessors

public[toStringTag]

  • get [toStringTag](): string
  • Returns a string representation of the object.


    Returns string

publicstate

Methods

publiccatch

  • catch<TResult>(onrejected?: null | (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>
  • Attaches a callback for only the rejection of the promise.


    Type parameters

    • TResult = never

    Parameters

    • optionalonrejected: null | (reason: any) => TResult | PromiseLike<TResult>

      Returns Promise<T | TResult>

    publicfinally

    • finally(onfinally?: null | () => void): Promise<T>
    • Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The


      Parameters

      • optionalonfinally: null | () => void

        The callback to execute when the Promise is settled (fulfilled or rejected).

        Returns Promise<T>

      publicreject

      • reject(reason?: any): void
      • Rejects the promise with a reason.


        Parameters

        • optionalreason: any

          The reason why the promise was rejected.

        Returns void

      publicresolve

      • resolve(value: T | PromiseLike<T>): void
      • Resolves the promise with a value or the result of another promise.


        Parameters

        • value: T | PromiseLike<T>

          The value to resolve the promise with.

        Returns void

      publicthen

      • then<TResult1, TResult2>(onfulfilled?: null | (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: null | (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>
      • Attaches callbacks for the resolution and/or rejection of the promise.


        Type parameters

        • TResult1 = T
        • TResult2 = never

        Parameters

        • optionalonfulfilled: null | (value: T) => TResult1 | PromiseLike<TResult1>

          The callback to execute when the promise is resolved.

          • optionalonrejected: null | (reason: any) => TResult2 | PromiseLike<TResult2>

            The callback to execute when the promise is rejected.

            Returns Promise<TResult1 | TResult2>