JSPM

@hazae41/future

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 102
  • Score
    100M100P100Q76125F
  • License MIT

Like a Promise but you can manually fulfill or reject it

Package Exports

  • @hazae41/future

Readme

Like a Promise but you can manually fulfill or reject it

npm i @hazae41/future

Node Package 📦

Features

Current features

  • 100% TypeScript and ESM
  • No external dependencies
  • Unit-tested

Usage

const future = new Future<void, unknown>()

const okTimeout = setTimeout(() => future.ok(), 1000)
const errTimeout = setTimeout(() => future.err(), 2000)

try {
  await future.promise
} finally {
  clearTimeout(okTimeout)
  clearTimeout(errTimeout)
}