Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Promise models a promise for a future value. This class has platform specific behaviors.

Type parameters

  • T

Hierarchy

  • Promise

Index

Constructors

Properties

Methods

Constructors

  • new Promise<T>(init?: (T: any, any: any) => void): Promise<T>
  • Create a new promise.

    Type parameters

    • T

    Parameters

    • Optional init: (T: any, any: any) => void
        • (T: any, any: any): void
        • Parameters

          • T: any
          • any: any

          Returns void

    Returns Promise<T>

Properties

id: number

The identifier of the promise

Methods

  • catchError(rejectCallback: (any: any) => void): any
  • Add a handler to catch an error.

    Parameters

    • rejectCallback: (any: any) => void

      the error handler.

        • (any: any): void
        • Parameters

          • any: any

          Returns void

    Returns any

  • setId(id: number): void
  • Set the identifier.

    Parameters

    • id: number

    Returns void

  • then(fulfillCallback: (T: any) => void, rejectCallback?: (any: any) => void): any
  • Add handlers to process the response or catch an error.

    Parameters

    • fulfillCallback: (T: any) => void

      the response handler.

        • (T: any): void
        • Parameters

          • T: any

          Returns void

    • Optional rejectCallback: (any: any) => void

      the optional error handler.

        • (any: any): void
        • Parameters

          • any: any

          Returns void

    Returns any