# eventemitter-asyncresource

> AsyncResource integration for EventEmitter

Latest version **1.0.0** (published 2020-05-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install eventemitter-asyncresource
pnpm add eventemitter-asyncresource
yarn add eventemitter-asyncresource
bun add eventemitter-asyncresource
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-05-09 |
| First published | 2020-05-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Anna Henningsen |
| Maintainers | addaleax |
| Keywords | EventEmitter, AsyncResource, async_hooks, events |

## Links

- npm: https://www.npmjs.com/package/eventemitter-asyncresource
- Repository: https://github.com/addaleax/eventemitter-asyncresource
- Homepage: https://github.com/addaleax/eventemitter-asyncresource#readme
- Issues: https://github.com/addaleax/eventemitter-asyncresource/issues
- npm.io page: https://npm.io/package/eventemitter-asyncresource

## 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.0 (latest) — 2020-05-09

## README

# eventemitter-asyncresource - AsyncResource integration for EventEmitter

Integrates [`EventEmitter`][] with [`AsyncResource`][] for `EventEmitter`s that
require manual async tracking.

```js
const { EventEmitterAsyncResource } = require('eventemitter-asyncresource');

// Async tracking tooling will identify this as 'Q'.
const ee = new EventEmitterAsyncResource({ name: 'Q' });

// 'foo' listeners will run in this EventEmitter’s async context.P
ee.emit('foo');
```

The `EventEmitterAsyncResource` class has the same methods and takes the same
options as `EventEmitter` and `AsyncResource` themselves.

It provides an `.asyncResource` property that allows accessing the async
resource in question, which in turn provides the original `EventEmitter` via
`.eventEmitter`, i.e. in the above example
`ee.asyncResource.eventEmitter === ee`.

[`EventEmitter`]: https://nodejs.org/api/events.html#events_class_eventemitter
[`AsyncResource`]: https://nodejs.org/api/async_hooks.html#async_hooks_class_asyncresource

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