# conflux-web-core-promievent

> This package extends eventEmitters with promises to allow chaining as well as multiple final states of a function.

Latest version **1.2.2-alpha.0** (published 2019-09-05) · LGPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install conflux-web-core-promievent
pnpm add conflux-web-core-promievent
yarn add conflux-web-core-promievent
bun add conflux-web-core-promievent
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2-alpha.0 |
| Published | 2019-09-05 |
| First published | 2019-09-05 |
| Weekly downloads | 0 |
| License | LGPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 2 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | liuis |

## Links

- npm: https://www.npmjs.com/package/conflux-web-core-promievent
- Repository: https://github.com/Conflux-Chain/ConfluxWeb/tree/conflux-web-1.2.1/packages/conflux-web-core-promievent
- npm.io page: https://npm.io/package/conflux-web-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.2-alpha.0 (latest) — 2019-09-05

## README

# conflux-web-core-promievent

This is a sub package of [conflux-web][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 conflux-web-core-promievent
```

### In the Browser

Build running the following in the [conflux-web][repo] repository:

```bash
npm run-script build-all
```

Then include `dist/conflux-web-core-promievent.js` in your html file.
This will expose the `ConfluxWebPromiEvent` object on the window object.


## Usage

```js
// in node.js
var ConfluxWebPromiEvent = require('conflux-web-core-promievent');

var myFunc = function(){
    var promiEvent = ConfluxWebPromiEvent();
    
    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]: https://phabricator.conflux-chain.org/w/javascript_api/
[repo]: https://github.com/Conflux-Chain/ConfluxWeb/tree/conflux-web-1.2.1

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