# platon-web3-core-promievent

> This package extends the EventEmitter with the Promise class to allow chaining as well as multiple final states of a function.

Latest version **1.2.4** (published 2021-12-28) · LGPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install platon-web3-core-promievent
pnpm add platon-web3-core-promievent
yarn add platon-web3-core-promievent
bun add platon-web3-core-promievent
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: no vulnerabilities; popular repo.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.4 |
| Published | 2021-12-28 |
| First published | 2021-12-28 |
| Weekly downloads | 0 |
| License | LGPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 2 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19908 |
| Maintainers | rileyge |

## Links

- npm: https://www.npmjs.com/package/platon-web3-core-promievent
- Repository: https://github.com/ethereum/web3.js/tree/1.x/packages/web3-core-promievent
- npm.io page: https://npm.io/package/platon-web3-core-promievent

## Dependencies (2)

- [any-promise](https://npm.io/package/any-promise.md) 1.3.0
- [eventemitter3](https://npm.io/package/eventemitter3.md) 3.1.2

## Recent versions

- 1.2.4 (latest) — 2021-12-28
- 1.2.7-beta.0 (beta) — 2021-12-29

## README

# web3-core-promievent

This is a sub package of [web3.js][repo]

This is the PromiEvent package is 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.

## Installation

### Node.js

```bash
npm install web3-core-promievent
```

### In the Browser

Build running the following in the [web3.js][repo] repository:

```bash
npm run-script build-all
```

Then include `dist/web3-core-promievent.js` in your html file.
This will expose the `Web3PromiEvent` object on the window object.


## Usage

```js
// in node.js
var Web3PromiEvent = require('web3-core-promievent');

var myFunc = function(){
    var promiEvent = Web3PromiEvent();
    
    setTimeout(function() {
        promiEvent.eventEmitter.emit('done', 'Hello!');
        promiEvent.resolve('Hello!');
    }, 10);
    
    return promiEvent.eventEmitter;
};


// and run it
myFunc()
.then(console.log);
.on('done', console.log);
```


[docs]: http://web3js.readthedocs.io/en/1.0/
[repo]: https://github.com/ethereum/web3.js

---
_Source: https://npm.io/package/platon-web3-core-promievent · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
