Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface PromiseConstructor

Hierarchy

  • PromiseConstructor

Index

Constructors

Properties

Methods

Constructors

constructor

  • Creates a new Promise.

    Type parameters

    • T

    Parameters

    • executor: function

      A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

        • (resolve: function, reject: function): void
        • Parameters

          • resolve: function
              • (value?: T | PromiseLike<T>): void
              • Parameters

                • Optional value: T | PromiseLike<T>

                Returns void

          • reject: function
              • (reason?: any): void
              • Parameters

                • Optional reason: any

                Returns void

          Returns void

    Returns PromiseConstructor

Properties

prototype

prototype: Promise<any>

A reference to the prototype.

Methods

all

  • Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects. the array passed to all can be a mixture of promise-like objects and other objects. The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.

    Type parameters

    • T

    Parameters

    Returns Promise<T[]>

cast

race

  • Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.

    Type parameters

    • T

    Parameters

    Returns Promise<T>

reject

  • Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error

    Parameters

    • error: any

    Returns Promise<any>

resolve

  • resolve<T>(promise?: PromiseLike<T>): Promise<T>
  • resolve<T>(object?: T): Promise<T>
  • Make a new promise from the PromiseLike. A promise-like can be anything as far as it has a "then" method. This also creates a new promise if you pass it a genuine JavaScript promise, making it less efficient for casting than Promise.cast.

    Type parameters

    • T

    Parameters

    • Optional promise: PromiseLike<T>

    Returns Promise<T>

  • Make a promise that fulfills to obj. Same as Promise.cast(obj) in this situation.

    Type parameters

    • T

    Parameters

    • Optional object: T

    Returns Promise<T>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method