Just like a Promise but you can manually resolve or reject it
npm install @hazae41/future
Just like a Promise but you can manually resolve or reject it
``bash`
npm i @hazae41/future
`typescript
import { Future } from "@hazae41/future"
const future = new Future
const t1 = setTimeout(() => future.resolve(), 1000)
const t2 = setTimeout(() => future.reject(), 2000)
try {
await future.promise
} finally {
clearTimeout(t1)
clearTimeout(t2)
}
``