🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

eventemitter-asyncresource

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eventemitter-asyncresource

AsyncResource integration for EventEmitter

1.0.0
latest
Source
npm
Version published
Weekly downloads
910K
4.93%
Maintainers
1
Weekly downloads
 
Created
Source

eventemitter-asyncresource - AsyncResource integration for EventEmitter

Integrates EventEmitter with AsyncResource for EventEmitters that require manual async tracking.

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.

Keywords

EventEmitter

FAQs

Package last updated on 09 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts