
Company News
Socket Has Acquired Secure Annex
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.
async-listener
Advanced tools
This is an implementation of Trevor Norris's process.{addAsyncListener,removeAsyncListener} API for adding behavior to async calls. You can see his implementation (currently a work in progress) on Node.js core pull request #5011. This polyfill / shim is intended for use in versions of Node prior to whatever version of Node in which Trevor's changes finally land (anticipated at the time of this writing as 0.11.7).
Here's his documentation of the intended API, which will probably get cleaned up here later:
listener {Function}callbacks {Object}storage {Value}Returns a constructed AsyncListener object. Which can then be passed to
process.addAsyncListener() and process.removeAsyncListener(). Each
function parameter is as follows:
listener(storage): A Function called as an asynchronous event is
queued. If a {Value} is returned then it will be attached to the event as
storage and overwrite any pre-defined value passed to
createAsyncListener(). If a storage argument is passed initially then
it will also be passed to listener().callbacks: An Object which may contain three optional fields:
before(context, storage): A Function that is called immediately
before the asynchronous callback is about to run. It will be passed both
the context (i.e. this) of the calling function and the storage
either returned from listener or passed during construction (if either
was done).after(context, storage): A Function called immediately after the
asynchronous event's callback is run. Note that if the event's callback
throws during execution this will not be called.error(storage, error): A Function called if the event's callback
threw. If error returns true then Node will assume the error has
been properly handled and resume execution normally.storage: A Value (i.e. anything) that will be, by default, attached
to all new event instances. This will be overwritten if a Value is
returned by listener().Returns a constructed AsyncListener object and immediately adds it to
the listening queue.
Removes the asyncListener from the listening queue.
The async_hooks module is a core Node.js module that provides an API to track asynchronous resources. It is similar to async-listener but is built into Node.js, offering more direct integration and potentially better performance. However, async-listener might offer a simpler API for certain use cases.
cls-hooked is a continuation-local storage package that allows you to maintain context across asynchronous calls. It is similar to async-listener in that it helps manage context in async operations, but it focuses more on maintaining state rather than tracking the lifecycle of async events.
FAQs
Polyfill exporting trevnorris's 0.11+ asyncListener API.
The npm package async-listener receives a total of 1,427,294 weekly downloads. As such, async-listener popularity was classified as popular.
We found that async-listener demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

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.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.

Research
/Security News
Socket is tracking cloned Open VSX extensions tied to GlassWorm, with several updated from benign-looking sleepers into malware delivery vehicles.

Product
Reachability analysis for PHP is now available in experimental, helping teams identify which vulnerabilities are actually exploitable.