Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
async-glob-events
Advanced tools
Event emitter with glob support on event names and asynchronous listeners
Event emitter with glob support on event names and asynchronous listeners, for node and the browser
emit
and receive asynchronous
errors and return values from listenersnpm install async-glob-events
Use Browserify to create a standalone file.
var AsyncEmitter = require('async-glob-events').AsyncEmitter;
var asyncEmitter = new AsyncEmitter();
asyncEmitter.on('add', function (a, b, callback) {
setTimeout(function () {
callback(null, a + b);
}, 100);
});
asyncEmitter.emit('add', 3, 4, function (err, value) {
assert.equal(value, 7);
});
Listeners may also return value immediately:
asyncEmitter.on('add', function (a, b) {
return a + b;
});
This makes it possible to change an implementation from synchronous to asynchronous without modifying the caller.
The callback passed to emit
is only invoked once all invoked listeners
returned.
The API is identical to glob-events with these additions:
emit(event[, ...], callback)
will invoke the given callback once all
listeners yielded. The callback is called with (err, value)
.emit({ event : 'name', allResults : true }[, ...], callback)
retrieves an
array with all non-undefined
return values of all listeners.invoke(iterator, scope[, callback])
is an async override of the
glob-events implementation. The given callback is invoked once all
listeners yielded.this.callback()
in listeners returns a callback which has to be invoked for
emit
to yield. this.callback
is a listen instance.MIT
1.5.0
emitError
from glob-events@1.6
emitError
when an exception is caughtFAQs
Event emitter with glob support on event names and asynchronous listeners
We found that async-glob-events demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.