Skip to main content

Deferred<Value>

Deferred.make()

Returns a future and its resolver:

import { Deferred } from "@swan-io/boxed";

const [future, resolve] = Deferred.make<string>();

// subscribe to the promise
future.onResolve(console.log);

// resolve from elsewhere
resolve("Hello!");