
Security News
New CNA Scorecard Tool Ranks CVE Data Quality Across the Ecosystem
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
An asynchronous event emitter for node.js and the browser. Heavily inspired by component/emitter.
Using component:
component install matthewmueller/aemitter
Using node.js:
npm install aemitter
var Emitter = require('aemitter');
var user = { name: 'matt' };
Emitter(user);
user.on('save', function(data, next) {
// save data
next()
});
user.emit('save', data, function(err) {
// called after all `save` callbacks have completed
});
Register an event
handler fn
. The signature of fn
will be all the arguments emitted + the next(err)
function. If this function is not specified, Emitter#on
will immediately return.
user.on('save', function(next) {
// asynchronous, will wait for `next` to be called
});
user.on('save', function() {
// immediately returns
})
user.emit('save');
It's important to note that next
will be passed as the last argument. If Emitter#emit
passes four arguments, next
will be it's fifth.
Register a single-shot event
handler fn
,
removed immediately after it is invoked the
first time.
Remove event
handler fn
, or pass only the event
name to remove all handlers for event
.
Emit an event
with variable option args, and a final, optional callback fn
. This fn
will be called when all the event callbacks have finished.
Caveat: You will need to be consistent with the emit
signature, otherwise Emitter#on()
callbacks will be inconsistent and likely fail. For example:
user.emit('save', data, message, fn); // main signature
user.emit('save', data, fn); // will NOT work as expected
user.emit('save', data, '', fn); // will work as expected
user.emit('save', data, ''); // will also work as expected
Return an array of callbacks, or an empty array.
Check if this emitter has event
handlers.
npm install . mocha test
MIT
FAQs
async emitter
The npm package aemitter receives a total of 0 weekly downloads. As such, aemitter popularity was classified as not popular.
We found that aemitter 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.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.