An util to create promises and control their lifecycle from other scope. In other frameworks they usually call it "Deferred" too.
Example:
function sleep(ms) { const future = new Future() setTimeout(() => future.resolve(), ms) return future.promise }
async function main() { await sleep(1000) }
Optional
Generated using TypeDoc
An util to create promises and control their lifecycle from other scope. In other frameworks they usually call it "Deferred" too.
Example:
function sleep(ms) { const future = new Future() setTimeout(() => future.resolve(), ms) return future.promise }
async function main() { await sleep(1000) }