promise-planner
v1.1.0
Published
Plan multiple named tasks and only resolve after all tasks are marked as done
Downloads
5
Maintainers
Readme
promise-planner
Plan multiple named tasks and only resolve after all tasks are marked as done
Install
$ npm i promise-planner
Usage
const Planner = require('promise-planner')
const plan = new Planner(
['foo', 'bar', 'baz'],
async (...args) => {
console.log('args', args)
return doSomethingAsync(...args)
}
)
plan.then(() => {
console.log('completed')
})
plan.resolve('foo', 1)
plan.resolve('bar', 2)
plan.resolve('baz', 3)
// args [1, 2, 3]
// completed