import { asyncTask } from "https://deno.land/x/ayonli_jsext@v0.9.72/async.ts";
Creates a promise that can be resolved or rejected manually.
This function is like Promise.withResolvers
but less verbose.
Examples
Example 1
Example 1
import { asyncTask } from "@ayonli/jsext/async";
const task = asyncTask<number>();
setTimeout(() => task.resolve(42), 1000);
const result = await task;
console.log(result); // 42