Class Deferred<T>

Simple implementation of the deferred pattern. An object that exposes a promise and functions to resolve and reject it.

Type Parameters

  • T = void

Constructors

Properties

Methods

Constructors

Properties

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

Type declaration

    • (err?): void
    • Parameters

      • Optional err: unknown

      Returns void

resolve: ((value) => void)

Type declaration

    • (value): void
    • Parameters

      • value: T | PromiseLike<T>

      Returns void

state: "resolved" | "rejected" | "unresolved" = 'unresolved'

Methods