@esfx/async-deferred
The @esfx/async-deferred
package provides the Deferred
class, an async coordination primitive.
Overview
Installation
npm i @esfx/async-deferred
Usage
import { Deferred } from "@esfx/async-deferred";
const deferred = new Deferred();
// to resolve the deferred:
deferred.resolve(value);
// to reject the deferred:
deferred.reject(error);
// get the promise for the deferred:
deferred.promise;
API
You can read more about the API here.