Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fun/mod.ts>promise.deferred

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function promise.deferred
import { promise } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { deferred } = promise;

Create a Deferred from a type.

Examples

Example 1

import { deferred } from "./promise.ts";

const promise = deferred<number>();

// Logs 1 after a second
promise.then(console.log);
setTimeout(() => promise.resolve(1), 1000);

Type Parameters

optional
A = never