Type parameters

  • T

  • TProgress

Hierarchy

  • Promise

Index

Constructors

constructor

  • new Promise(executor: function, oncancel?: function): Promise
  • Parameters

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

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

                • value: T | PromiseLike<T>

                Returns void

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

                • reason: any

                Returns void

          • progress: function
              • (progress: TProgress): void
              • Parameters

                • progress: TProgress

                Returns void

          Returns void

    • Optional oncancel: function
        • (): void
        • Returns void

    Returns Promise

Methods

cancel

  • cancel(): void

done

  • done(onfulfilled?: function, onrejected?: function, onprogress?: function): void
  • Parameters

    • Optional onfulfilled: function
        • (value: T): void
        • Parameters

          • value: T

          Returns void

    • Optional onrejected: function
        • (reason: any): void
        • Parameters

          • reason: any

          Returns void

    • Optional onprogress: function
        • (progress: TProgress): void
        • Parameters

          • progress: TProgress

          Returns void

    Returns void

then

  • then<TResult1, TResult2>(onfulfilled?: function | null, onrejected?: function | null, onprogress?: function): Promise<TResult1 | TResult2, TProgress>
  • Type parameters

    • TResult1

    • TResult2

    Parameters

    • Optional onfulfilled: function | null
    • Optional onrejected: function | null
    • Optional onprogress: function
        • (progress: TProgress): void
        • Parameters

          • progress: TProgress

          Returns void

    Returns Promise<TResult1 | TResult2, TProgress>

Static any

  • any<T>(promises: (T | PromiseLike<T>)[]): Promise<object>
  • Type parameters

    • T

    Parameters

    • promises: (T | PromiseLike<T>)[]

    Returns Promise<object>

Static as

  • as(value: null): Promise<null>
  • as(value: undefined): Promise<undefined>
  • as<T>(value: PromiseLike<T>): PromiseLike<T>
  • as<T, SomePromise>(value: SomePromise): SomePromise
  • as<T>(value: T): Promise<T>
  • Parameters

    • value: null

    Returns Promise<null>

  • Parameters

    • value: undefined

    Returns Promise<undefined>

  • Type parameters

    • T

    Parameters

    • value: PromiseLike<T>

    Returns PromiseLike<T>

  • Type parameters

    • T

    • SomePromise: PromiseLike<T>

    Parameters

    • value: SomePromise

    Returns SomePromise

  • Type parameters

    • T

    Parameters

    • value: T

    Returns Promise<T>

Static is

  • is(value: any): boolean

Static join

  • join<T1, T2>(promises: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>
  • join<T>(promises: (T | PromiseLike<T>)[]): Promise<T[]>
  • Type parameters

    • T1

    • T2

    Parameters

    • promises: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]

    Returns Promise<[T1, T2]>

  • Type parameters

    • T

    Parameters

    • promises: (T | PromiseLike<T>)[]

    Returns Promise<T[]>

Static timeout

  • timeout(delay: number): Promise<void>

Static wrap

  • wrap<T>(value: T | PromiseLike<T>): Promise<T>

Static wrapError

  • wrapError<T>(error: Error): Promise<T>