
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
Get the first event in a set of event emitters and event pairs, then clean up after itself.
$ npm install ee-first
var first = require('ee-first')
Invoke listener on the first event from the list specified in arr. arr is
an array of arrays, with each array in the format [ee, ...event]. listener
will be called only once, the first time any of the given events are emitted. If
error is one of the listened events, then if that fires first, the listener
will be given the err argument.
The listener is invoked as listener(err, ee, event, args), where err is the
first argument emitted from an error event, if applicable; ee is the event
emitter that fired; event is the string event name that fired; and args is an
array of the arguments that were emitted on the event.
var ee1 = new EventEmitter()
var ee2 = new EventEmitter()
first([
[ee1, 'close', 'end', 'error'],
[ee2, 'error']
], function (err, ee, event, args) {
// listener invoked
})
The group of listeners can be cancelled before being invoked and have all the event listeners removed from the underlying event emitters.
var thunk = first([
[ee1, 'close', 'end', 'error'],
[ee2, 'error']
], function (err, ee, event, args) {
// listener invoked
})
// cancel and clean up
thunk.cancel()
The event-promise package provides a way to wait for an event to be emitted using promises. It is similar to ee-first in that it deals with events, but it works with individual emitters and events rather than a collection of them.
Await-event is another package that allows you to wait for an event to be emitted, but it is designed to be used with async/await syntax for a single EventEmitter. Unlike ee-first, it does not handle multiple emitters.
Event-to-promise converts events to promises, similar to event-promise. It allows you to wait for an event on an EventEmitter, but it does not provide the functionality to listen to multiple emitters and act on the first event like ee-first does.
FAQs
return the first event in a set of ee/event pairs
The npm package ee-first receives a total of 39,324,089 weekly downloads. As such, ee-first popularity was classified as popular.
We found that ee-first demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.