Gathering detailed insights and metrics for @digitalbazaar/async-node-events
Gathering detailed insights and metrics for @digitalbazaar/async-node-events
Gathering detailed insights and metrics for @digitalbazaar/async-node-events
Gathering detailed insights and metrics for @digitalbazaar/async-node-events
Asynchronous cancelable (or not) EventEmitter-like object
npm install @digitalbazaar/async-node-events
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
1 Stars
85 Commits
12 Watchers
2 Branches
12 Contributors
Updated on Jun 14, 2022
Latest Version
3.0.0
Package Id
@digitalbazaar/async-node-events@3.0.0
Unpacked Size
28.79 kB
Size
7.48 kB
File Count
9
NPM Version
6.14.16
Node Version
14.19.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
An EventEmitter replacement that allows both asynchronous and synchronous emissions and handlers. This is entirely based off of and almost entirely written by @dfellis in his excellent async-cancelable-events module. Even this README is primarily written by @dfellis. Recent updates are from Digital Bazaar.
This version is primarily targeted at using Promises and async/await with
emit
and listeners. Namely, the asynchronous emit
will return a Promise
which can be awaited upon. Listeners are run in series and their result is
awaited upon. Throwing an error from a listener that executed asynchronously
will terminate the listener chain (subsequent listeners will not receive the
emitted event and the emit
Promise will be rejected. Events may also be
canceled by a listener resolving to or returning false
. This will stop
further event emission to other listeners and return false
rather than
undefined
, but not raise an error.
The synchronous emitSync
variant acts like the asynchronous emit
but
only allows synchronous listeners.
The listener manipulation methods (on
, off
, etc) are synchronous and
use emitSync
to emit newListener
, removeListener
, and
maxListenersPassed
. Listeners for these events must be synchronous.
1npm install async-node-events
1var EventEmitter = require('async-node-events').EventEmitter; 2var util = require('util'); 3 4(async () => { 5 const myEmitter = new EventEmitter(); 6 myEmitter.on('test', async (...) => { 7 ... 8 }); 9 await myEmitter.emit('test', ...); 10})(); 11 12function MyEmittingObject() { 13 EventEmitter.call(this); 14 ... 15} 16 17util.inherits(MyEmittingObject, EventEmitter);
The API is intended to be a mostly-drop-in replacement for Node.js'
EventEmitter
object, except with support for asynchronous listeners.
The primary differences between the EventEmitter
and async-node-events
are:
maxListenersPassed
event with the event name and listener count as
arguments. The warning the official EventEmitter
prints is simply a
listener for async-node-events
, and can be disabled by running
this.removeAllListeners('maxListenersPassed')
just after the
EventEmitter.call(this)
listed above.foo.on('bar', func1).on('baz', func2)
is valid.emit
and emitSync
return undefined
if the even was emitted to all
listeners and false
when a listener caused cancellation. This differs from
returning an indication if there were listeners.Copyright (C) 2012-2013 by David Ellis
Copyright (C) 2014-2019 Digital Bazaar
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 2/17 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More