Class Defer<T>

An externally resolvable/rejectable "promise". Use it to resolve/reject promise at any time.

const future = new Defer();

future.promise.then(value => console.log(value));

future.resolve(123);

Type Parameters

  • T

Constructors

Properties

Constructors

Properties

promise: Promise<T> = ...
reject: ((error) => void)

Type declaration

    • (error): void
    • Parameters

      • error: any

      Returns void

resolve: ((data) => void)

Type declaration

    • (data): void
    • Parameters

      • data: T

      Returns void