1.0.3 • Published 8 years ago

global-asyncawaitpromise v1.0.3

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

global-asyncawaitpromise

One liner to add async/await and promises to your project

Check out asyncawaitpromise for a version that does not use globals

Quickstart

require('global-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 will be available globally

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')