eadolores
Version:
Desig: The Blockchain-Agnostic Multisig Solution
49 lines (34 loc) • 1.48 kB
Markdown
[![NPM Package][npm-image]][npm-url] [![Dependency Status][deps-image]][deps-url] [![Dev Dependency Status][deps-dev-image]][deps-dev-url]
This is a sub-package of [web3.js][repo].
This is the PromiEvent package used to return a EventEmitter mixed with a Promise to allow multiple final states as well as chaining.
Please read the [documentation][docs] for more.
```bash
npm install web3-core-promievent
```
```js
const Web3PromiEvent = require('web3-core-promievent');
const myFunc = function(){
const promiEvent = Web3PromiEvent();
setTimeout(function() {
promiEvent.eventEmitter.emit('done', 'Hello!');
promiEvent.resolve('Hello!');
}, 10);
return promiEvent.eventEmitter;
};
// and run it
myFunc()
.on('done', console.log)
.then(console.log);
```
[]: http://web3js.readthedocs.io/en/1.0/
[]: https://github.com/ethereum/web3.js
[]: https://img.shields.io/npm/v/web3-core-promievent.svg
[]: https://npmjs.org/package/web3-core-promievent
[]: https://david-dm.org/ethereum/web3.js/1.x/status.svg?path=packages/web3-core-promievent
[]: https://david-dm.org/ethereum/web3.js/1.x?path=packages/web3-core-promievent
[]: https://david-dm.org/ethereum/web3.js/1.x/dev-status.svg?path=packages/web3-core-promievent
[]: https://david-dm.org/ethereum/web3.js/1.x?type=dev&path=packages/web3-core-promievent