Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface PromiseConstructor

Hierarchy

  • PromiseConstructor

Index

Constructors

Properties

Methods

Constructors

constructor

  • new PromiseConstructor<T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>
  • Creates a new Promise.

    Type parameters

    • T

    Parameters

    • executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void

      A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to 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: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void): void
        • Parameters

          • resolve: (value?: T | PromiseLike<T>) => void
          • reject: (reason?: any) => void
              • (reason?: any): void
              • Parameters

                • Optional reason: any

                Returns void

          Returns void

    Returns Promise<T>

Properties

[Symbol.species]

[Symbol.species]: PromiseConstructor

prototype

prototype: Promise<any>

A reference to the prototype.

Methods

all

  • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

    Type parameters

    • TAll

    Parameters

    Returns Promise<TAll[]>

    A new Promise.

  • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

    Type parameters

    • T1

    • T2

    • T3

    • T4

    • T5

    • T6

    • T7

    • T8

    • T9

    • T10

    Parameters

    Returns Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>

    A new Promise.

  • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

    Type parameters

    • T1

    • T2

    • T3

    • T4

    • T5

    • T6

    • T7

    • T8

    • T9

    Parameters

    Returns Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>

    A new Promise.

  • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

    Type parameters

    • T1

    • T2

    • T3

    • T4

    • T5

    • T6

    • T7

    • T8

    Parameters

    Returns Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>

    A new Promise.

  • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

    Type parameters

    • T1

    • T2

    • T3

    • T4

    • T5

    • T6

    • T7

    Parameters

    Returns Promise<[T1, T2, T3, T4, T5, T6, T7]>

    A new Promise.

  • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

    Type parameters

    • T1

    • T2

    • T3

    • T4

    • T5

    • T6

    Parameters

    Returns Promise<[T1, T2, T3, T4, T5, T6]>

    A new Promise.

  • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

    Type parameters

    • T1

    • T2

    • T3

    • T4

    • T5

    Parameters

    Returns Promise<[T1, T2, T3, T4, T5]>

    A new Promise.

  • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

    Type parameters

    • T1

    • T2

    • T3

    • T4

    Parameters

    Returns Promise<[T1, T2, T3, T4]>

    A new Promise.

  • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

    Type parameters

    • T1

    • T2

    • T3

    Parameters

    Returns Promise<[T1, T2, T3]>

    A new Promise.

  • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

    Type parameters

    • T1

    • T2

    Parameters

    Returns Promise<[T1, T2]>

    A new Promise.

  • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

    Type parameters

    • T

    Parameters

    • values: keyof (T | PromiseLike<T>)[]

      An array of Promises.

    Returns Promise<T[]>

    A new Promise.

race

  • Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.

    Type parameters

    • T

    Parameters

    Returns Promise<T>

    A new Promise.

  • Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.

    Type parameters

    • T

    Parameters

    • values: keyof T[]

      An array of Promises.

    Returns Promise<T extends PromiseLike<infer U> ? U : T>

    A new Promise.

  • Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.

    Type parameters

    • T

    Parameters

    • values: Iterable<T>

      An iterable of Promises.

    Returns Promise<T extends PromiseLike<infer U> ? U : T>

    A new Promise.

reject

  • reject<T>(reason?: any): Promise<T>
  • Creates a new rejected promise for the provided reason.

    Type parameters

    • T

    Parameters

    • Optional reason: any

      The reason the promise was rejected.

    Returns Promise<T>

    A new rejected Promise.

resolve

  • Creates a new resolved promise for the provided value.

    Type parameters

    • T

    Parameters

    Returns Promise<T>

    A promise whose internal state matches the provided promise.

  • Creates a new resolved promise .

    Returns Promise<void>

    A resolved promise.