Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ExtendedPromiseConstructor

A promise constructor extended by all the functionality of promise-stuff.

Hierarchy

  • ExtendedPromiseConstructor

Index

Constructors

Properties

Methods

Constructors

constructor

  • new ExtendedPromiseConstructor<T>(executor: function): ExtendedPromise<T>
  • 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 ExtendedPromise<T>

Properties

prototype

prototype: Promise<any>

A reference to the prototype.

Methods

create

  • Constructs a new promise, similarly to the Promise constructor. The main difference is that definition itself may return a promise (or be async). If the promise returned by definition rejects, the returned promise will also reject. Normally, this would cause the returned promise to hang.

    template

    T

    Type parameters

    • T

    Parameters

    • executor: function
        • (resolve: function, reject: function): void | Promise<void>
        • Parameters

          • resolve: function
              • (x: T): void
              • Parameters

                • x: T

                Returns void

          • reject: function
              • (y: T): void
              • Parameters

                • y: T

                Returns void

          Returns void | Promise<void>

    Returns ExtendedPromise<T>

    The return type is meant to be P<T>, where P is the underlying promise type.

eventOnce

  • eventOnce<TEvent, TTarget>(target: TTarget, event: TEvent): ExtendedPromise<any>
  • Type parameters

    Parameters

    • target: TTarget
    • event: TEvent

    Returns ExtendedPromise<any>

from

  • Converts the given Promise/A+ implementation into ExtendedPromise promise using this constructor.

    Type parameters

    • T

    Parameters

    • other: PromiseLike<T>

      The Promise/A+ implementation.

    Returns ExtendedPromise<T>

    The return type is meant to be P<T>, where P is the underlying promise type.

never

  • Returns a promise that will never resolve or reject.

    Returns ExtendedPromise<never>

    The return type is meant to be P<never>, where P is the underlying promise type.

soon

  • Schedules an action to occur immediately but after current code has finished executing, using the Promise's scheduling mechanism. This is similar to setTimeout(action, 0) or setImmediate(action).

    template

    T

    Type parameters

    • T

    Parameters

    • action: function

      The acion to execute.

        • (): T | PromiseLike<T>
        • Returns T | PromiseLike<T>

    Returns ExtendedPromise<T>

    The return type is meant to be P<T>, where P is the underlying promise type.

wait

  • Returns a promise that will wait for some time, and then resolve with the value given in value (undefined by default).

    template

    T

    Type parameters

    • T

    Parameters

    • deadline: number | Date

      If a number, the milliseconds to wait. If a date, the date to wait for.

    • Optional value: T

      The value to resolve with.

    Returns ExtendedPromise<T>

    The return type is meant to be P<T>, where P is the underlying promise type.

Generated using TypeDoc