1.0.1 • Published 8 years ago

asyncawaitpromise v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

asyncawaitpromise

One liner to add async/await and promises to your project, without globals

Check out global-asyncawaitpromise for a shorter one-liner that uses globals

Quickstart

const {Promise, async, await} = require('asyncawaitpromise')

// Now we can use async/await and Promise
const main = async(() => {
  console.log(3)
  await(Promise.delay(1000))
  console.log(2)
  await(Promise.delay(1000))
  console.log(1)
  await(Promise.delay(1000))
  console.log('🚀')
})

main()

Docs

The following objects are provided

Why do I need this?

Because callback hell sucks, and it's tedious to have to keep writing this boilerplate

const Promise = require('bluebird')
const async = require('asyncawait/async')
const await = require('asyncawait/await')
1.0.1

8 years ago

1.0.0

8 years ago