# promised-event

> Simply get a promise for a specified event

Latest version **1.0.2** (published 2017-02-26) · 0 weekly downloads

## Install

```sh
npm install promised-event
pnpm add promised-event
yarn add promised-event
bun add promised-event
```

## 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.0.2 |
| Published | 2017-02-26 |
| First published | 2017-02-19 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | jd342 |
| Keywords | event, promise |

## Links

- npm: https://www.npmjs.com/package/promised-event
- Repository: https://github.com/JD342/promised-event
- Homepage: https://github.com/JD342/promised-event#readme
- Issues: https://github.com/JD342/promised-event/issues
- npm.io page: https://npm.io/package/promised-event

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2017-02-26
- 1.0.1 — 2017-02-19

## README

# [promised-event][npm]

[![License][license-image]][license-url]
[![Build status][travis-image]][travis-url]

> Simply get a promise for a specified event

Promises the next dispatch of a specified [EventEmitter][event-emitter] event.
Nothing more, nothing less.

## Installation & usage

```
npm install promised-event
```
```js
cosnt promiseEvent = require('promised-event');
```
```js
const emitter = new EventEmitter();
promiseEvent(emitter, 'myevent').then((answer) => {
    console.log(answer);
});
emitter.emit('myevent', 42);
// 42
```

## Want to reject on error?

Simply do
```js
const promise = promiseEvent(stream, 'error').then(Promise.reject);
```
Then you can write
```js
promise.catch((err) => {
    console.log('oh no!');
});
```

## API

##### `promiseEvent(emitter, eventName)`

 * `emitter`: [EventEmitter][event-emitter];
 * `eventName`: [String][string] or [Symbol][symbol];
 * returns a [Promise][promise]

## License

MIT

[license-image]: https://img.shields.io/badge/license-MIT-blue.svg
[license-url]: LICENSE
[travis-image]: https://travis-ci.org/JD342/promised-event.svg?branch=master
[travis-url]: https://travis-ci.org/JD342/promised-event
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
[symbol]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Symbol
[promise]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise
[npm]: https://www.npmjs.com/package/promised-event

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