EventEmitter3 - Because there's also a number 2. And we're faster.
Installations
npm install eventemitter3
Score
99.8
Supply Chain
98
Quality
80
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Developer
primus
Developer Guide
Module System
CommonJS, ESM
Min. Node Version
Typescript Support
Yes
Node Version
20.0.0
NPM Version
9.6.4
Statistics
3,347 Stars
373 Commits
226 Forks
37 Watching
1 Branches
28 Contributors
Updated on 23 Nov 2024
Bundle Size
2.81 kB
Minified
1.06 kB
Minified + Gzipped
Languages
JavaScript (98.04%)
HTML (1.6%)
Shell (0.36%)
Total Downloads
Cumulative downloads
Total Downloads
6,172,929,714
Last day
-21.1%
5,839,936
Compared to previous day
Last week
-3.9%
37,814,940
Compared to previous week
Last month
4.7%
162,831,544
Compared to previous month
Last year
27.3%
1,589,421,732
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
EventEmitter3
EventEmitter3 is a high performance EventEmitter. It has been micro-optimized for various of code paths making this, one of, if not the fastest EventEmitter available for Node.js and browsers. The module is API compatible with the EventEmitter that ships by default with Node.js but there are some slight differences:
- Domain support has been removed.
- We do not
throw
an error when you emit anerror
event and nobody is listening. - The
newListener
andremoveListener
events have been removed as they are useful only in some uncommon use-cases. - The
setMaxListeners
,getMaxListeners
,prependListener
andprependOnceListener
methods are not available. - Support for custom context for events so there is no need to use
fn.bind
. - The
removeListener
method removes all matching listeners, not only the first.
It's a drop in replacement for existing EventEmitters, but just faster. Free performance, who wouldn't want that? The EventEmitter is written in EcmaScript 3 so it will work in the oldest browsers and node versions that you need to support.
Installation
1$ npm install --save eventemitter3
CDN
Recommended CDN:
1https://unpkg.com/eventemitter3@latest/dist/eventemitter3.umd.min.js
Usage
After installation the only thing you need to do is require the module:
1var EventEmitter = require('eventemitter3');
And you're ready to create your own EventEmitter instances. For the API documentation, please follow the official Node.js documentation:
http://nodejs.org/api/events.html
Contextual emits
We've upgraded the API of the EventEmitter.on
, EventEmitter.once
and
EventEmitter.removeListener
to accept an extra argument which is the context
or this
value that should be set for the emitted events. This means you no
longer have the overhead of an event that required fn.bind
in order to get a
custom this
value.
1var EE = new EventEmitter()
2 , context = { foo: 'bar' };
3
4function emitted() {
5 console.log(this === context); // true
6}
7
8EE.once('event-name', emitted, context);
9EE.on('another-event', emitted, context);
10EE.removeListener('another-event', emitted, context);
Tests and benchmarks
This module is well tested. You can run:
npm test
to run the tests under Node.js.npm run test-browser
to run the tests in real browsers via Sauce Labs.
We also have a set of benchmarks to compare EventEmitter3 with some available
alternatives. To run the benchmarks run npm run benchmark
.
Tests and benchmarks are not included in the npm package. If you want to play
with them you have to clone the GitHub repository.
Note that you will have to run an additional npm i
in the benchmarks folder
before npm run benchmark
.
License
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: : LICENSE:1
Reason
no vulnerabilities detected
Reason
dependency not pinned by hash detected -- score normalized to 7
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/liuyuchenzh/webpack-upload-plugin/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/liuyuchenzh/webpack-upload-plugin/ci.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/liuyuchenzh/webpack-upload-plugin/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/liuyuchenzh/webpack-upload-plugin/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/liuyuchenzh/webpack-upload-plugin/ci.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:22
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:38
- Info: Dockerfile dependencies are pinned
- Info: no insecure (not pinned by hash) dependency downloads found in Dockerfiles
- Info: no insecure (not pinned by hash) dependency downloads found in shell scripts
Reason
3 commit(s) out of 30 and 0 issue activity out of 30 found in the last 90 days -- score normalized to 2
Reason
GitHub code reviews found for 3 commits out of the last 30 -- score normalized to 1
Details
- Warn: no reviews found for commit: fdae3370662e138432ce27417a1acefa8d7b70cc
- Warn: no reviews found for commit: 4d52d09cabfc01b39194347480e350a47a7c7fa5
- Warn: no reviews found for commit: a87c148161445392e51b62eefefa22d833dc022f
- Warn: no reviews found for commit: acad2eb2e47b7fd44dbb3f61a930cada3b2c8b39
- Warn: no reviews found for commit: da8dcd833d5eeaf0d3640cf000c40ab0d7c88a19
- Warn: no reviews found for commit: 48fe79b84e550b02a1d10bf6d2f1f80f9d56cc99
- Warn: no reviews found for commit: 8b02fce39914b2f20c74b11484c022183cfc9c4b
- Warn: no reviews found for commit: 1ca3e72672a2d913aaad41126580825d12984db8
- Warn: no reviews found for commit: 8c11c89178153ca14c656917413af8b2bcedaeb4
- Warn: no reviews found for commit: ce123537b342afa6bbacc0cf3ec87e76743db017
- Warn: no reviews found for commit: 054bea52c2ae2925e8ff080d779467167ca78be5
- Warn: no reviews found for commit: 011477caf88744998c3ba606a895a2d571837971
- Warn: no reviews found for commit: 3f61c9fdddd77fa0a3567b8827b46d13eaae2cb3
- Warn: no reviews found for commit: e0c3b19937d3f12cf58ee6f1ba4fad04b1122941
- Warn: no reviews found for commit: 2926ed529b03c47977317d82c1df3d171ba0da59
- Warn: no reviews found for commit: 0474388416b874fe21a1ab2b8a03e2e5b13ec149
- Warn: no reviews found for commit: 295867e43e00f7aa97b6ff71fb657a74f13f8936
- Warn: no reviews found for commit: a680363225c078cf4851fb602f31ce4394328a8d
- Warn: no reviews found for commit: 3d880e26b0f945f18b2facee17a6d12e3a8f8d43
- Warn: no reviews found for commit: 5aa5efcbf29f1a9b9e680f440facd2498ea8be4e
- Warn: no reviews found for commit: 1563356d8bbc2b4cc749c51ee3e46e81f99ac42b
- Warn: no reviews found for commit: e8dff8bbc8853037939fddabcbc317123336a134
- Warn: no reviews found for commit: 00ac01a329b7f2fb29058b6a3aff6850ac304f12
- Warn: no reviews found for commit: 38de307205e78c574a53379b71f53058d45236c8
- Warn: no reviews found for commit: 47251a0649bec2e030ff6f11d056713a31985af9
- Warn: no reviews found for commit: aa8d192c50d2553948d9ce63d866237cb63251cc
- Warn: no reviews found for commit: 9a46cfddae3f76a67981ec05c65fbb4584a4063c
Reason
no badge detected
Reason
non read-only tokens detected in GitHub workflows
Details
- Warn: no topLevel permission defined: .github/workflows/ci.yml:1: update your workflow using https://app.stepsecurity.io/secureworkflow/liuyuchenzh/webpack-upload-plugin/ci.yml/master?enable=permissions
Reason
no update tool detected
Details
- Warn: dependabot config file not detected in source location. We recommend setting this configuration in code so it can be easily verified by others.
- Warn: renovatebot config file not detected in source location. We recommend setting this configuration in code so it can be easily verified by others.
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
project is not fuzzed
Reason
security policy file not detected
Score
4
/10
Last Scanned on 2022-08-15
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 MoreOther packages similar to eventemitter3
@robotlegsjs/eventemitter3
RobotlegsJS integration with EventEmitter3
@utsubo/events
react library for custom events. Based on eventemitter3
@yandeu/events
âš¡ Simplified and TypeScripted version of EventEmitter3@4.0.7
eventemitter3-timer
`EventEmitter3-Timer` is a plugin extend [EventEmitter3](https://github.com/primus/eventemitter3) to create time events easily.