0.0.6 • Published 4 years ago

remote-controlled-promise v0.0.6

Weekly downloads
43
License
MIT
Repository
github
Last release
4 years ago

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

License

MIT © Hoàng Văn Khải