remote-controlled-promise
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

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

Package Sidebar

Install

npm i remote-controlled-promise

Weekly Downloads

11

Version

0.0.6

License

MIT

Unpacked Size

3.33 kB

Total Files

6

Last publish

Collaborators

  • khai96_