Always be able to wait for a next promise
yarn add https://github.com/leobastiani/next-await
If you're using npm you can use:
npm install https://github.com/leobastiani/next-await
.
const { withNextAwait } = require('next-await')
const nextAwait = withNextAwait({})
const promise = nextAwait.nextAwait
console.log(promise)
nextAwait.nextAwait.resolve(123)
console.log(promise)
console.log(nextAwait.nextAwait)
MIT