remote-controlled-promise
v0.0.6
Published
Create a Promise object that is controllable from outside
Downloads
18
Maintainers
Readme
remote-controlled-promise
Create a Promise object that is controllable from outside
Requirements
- Node.js ≥ 8.9.0
Usage Example
import {create} from 'remote-controlled-promise'
// Create a controlled promise
const ctrl = create()
// `ctrl.promise` is a that controlled promise
ctrl.promise.then(value => console.log(`resolved ${value}`))
console.log('foo')
ctrl.resolve(1234)
console.log('bar')
This will print:
foo
bar
resolved 1234