augment-vir - v31.13.0
    Preparing search index...

    Class DeferredPromise<T>

    Creates a promise that can be resolved or rejected at any later time. It also includes indication on whether its been settled yet or not.

    import {DeferredPromise} from '@augment-vir/common';

    function waitForInput() {
    const deferred = new DeferredPromise<string>();

    window.addEventListener('keydown', (event) => {
    deferred.resolve(event.code);
    });
    return deferred.promise;
    }

    Type Parameters

    • T = void
    Index

    Constructors

    Properties

    Constructors

    Properties

    isSettled: boolean = false

    Indicates whether the promise has been settled (resolved or rejected) yet.

    promise: Promise<T>

    The deferred promise which can be awaited.

    reject: (reason?: any) => void

    Call this to reject the deferred promise with the given reason.

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

    Call this to resolve the deferred promise with the given value.