Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Hierarchy

  • Deferred

Index

Constructors

  • Type Parameters

    • T = void

    Returns Deferred<T>

Properties

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

Type declaration

    • (err?: unknown): void
    • Parameters

      • Optional err: unknown

      Returns void

resolve: ((value: T | PromiseLike<T>) => void)

Type declaration

    • (value: T | PromiseLike<T>): void
    • Parameters

      • value: T | PromiseLike<T>

      Returns void

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

Methods

  • setState(state: "resolved" | "rejected"): void