Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a Promise-like object. This interface is used for interoperability between different implementations of Promise.

Type parameters

  • T

Hierarchy

  • Thenable

Index

Methods

reject

  • Rejects the "thenable", invoking any attached rejection handlers and applying the supplied arguments.

    Parameters

    • Rest ...args: any[]

      Abritrary, optional arguments to pass. These typically represent the erroneous state that caused the operation to fail.

    Returns Thenable<T>

rejectWith

  • rejectWith(context: any, ...args: any[]): Thenable<T>
  • Rejects the "thenable", invoking any attached rejection handlers and applying the supplied arguments.

    Parameters

    • context: any
    • Rest ...args: any[]

      Abritrary, optional arguments to pass. These typically represent the erroneous state that caused the operation to fail.

    Returns Thenable<T>

resolve

  • Successfully resolves the "thenable" with the given value.

    Parameters

    • val: T

      The resolved value that the asynchronous operation produced.

    Returns Thenable<T>

then

  • then<U>(onFulfilled: function, onRejected: function, onProgress?: function): Thenable<U>
  • then<U>(onFulfilled: function, onRejected?: function, onProgress?: function): Thenable<U>
  • then<U>(onFulfilled: function, onRejected: function, onProgress?: function): Thenable<U>
  • then<U>(onFulfilled?: function, onRejected?: function, onProgress?: function): Thenable<U>
  • Adds a callback to be invoked upon successful resolution or erroneous completion of the asynchronous operation.

    doSomethingAsync()
        .then(result => console.log("Success!"), error => console.log("Something went wrong."));

    Type parameters

    • U

    Parameters

    • onFulfilled: function

      The callback to invoke if the "thenable" resolved successfully.

    • onRejected: function

      The callback to invoke if the "thenable" resolved erroneously.

    • Optional onProgress: function

      The progress handler to invoke as the underlying asynchronous operation progresses. Note: Not all implementations support this operation.

        • (note: any): any
        • Parameters

          • note: any

          Returns any

    Returns Thenable<U>

  • Type parameters

    • U

    Parameters

    • onFulfilled: function
    • Optional onRejected: function
        • (error: any): U
        • Parameters

          • error: any

          Returns U

    • Optional onProgress: function
        • (note: any): any
        • Parameters

          • note: any

          Returns any

    Returns Thenable<U>

  • Type parameters

    • U

    Parameters

    • onFulfilled: function
        • (value: T): U
        • Parameters

          • value: T

          Returns U

    • onRejected: function
    • Optional onProgress: function
        • (note: any): any
        • Parameters

          • note: any

          Returns any

    Returns Thenable<U>

  • Type parameters

    • U

    Parameters

    • Optional onFulfilled: function
        • (value: T): U
        • Parameters

          • value: T

          Returns U

    • Optional onRejected: function
        • (error: any): U
        • Parameters

          • error: any

          Returns U

    • Optional onProgress: function
        • (note: any): any
        • Parameters

          • note: any

          Returns any

    Returns Thenable<U>