Skip to main content
The Deno 2 Release Candidate is here
Learn more
Latest
function deferred
import { deferred } from "https://deno.land/x/denjucks@1.1.1/src/deps/path/std/async/deferred.ts";

Creates a Promise with the reject and resolve functions placed as methods on the promise object itself. It allows you to do:

const p = deferred<number>();
// ...
p.resolve(42);