These packages help different parts of your code communicate with each other using events. EventEmitter3 is a fast, simple way to handle events within your application, similar to Node.js's built-in EventEmitter. PubSub-js is more focused on the publish/subscribe pattern, where parts of your code can subscribe to topics and receive messages, making it great for loosely coupled applications.
Unable to load comparison data. Please try again later.
A tiny event emitter library that's super simple to use. It's less than 200 bytes in size and has a very straightforward API for handling events in your JavaScript applications.
Perfect for developers who want a simpler, more lightweight alternative to eventemitter3. It does the same core job but with less code and fewer features, which makes it easier to learn and use.
Event EmitterA small but capable event emitter that works in both browser and Node.js environments. Offers the basic features you need for event handling without any extra complexity.
Works as a drop-in replacement for eventemitter3 in most cases, while being smaller and simpler. Good for developers who want something easy to understand but still reliable.
Event EmitterA powerful message bus library that helps manage communication between different parts of your application. It's like a more advanced version of pubsub-js with extra features.
Great alternative to pubsub-js when you need more advanced features like message channels and hierarchical topics. It's especially good for larger applications.
Pub/Sub LibraryA very small event emitter library focused on being as tiny as possible. It provides basic event handling capabilities with minimal overhead.
Great choice when you need the smallest possible event emitter that still works well. It's perfect for small projects or when bundle size is super important.
Event EmitterA comprehensive library for handling events and data streams. While it's bigger than pubsub-js, it offers many powerful tools for managing how data flows through your application.
Perfect when you need more than just basic pub/sub functionality. It's great for complex applications where you need to transform, combine, or filter events in advanced ways.
Reactive Programming LibraryEventEmitter3 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:
throw
an error when you emit an error
event and nobody is
listening.newListener
and removeListener
events have been removed as they
are useful only in some uncommon use-cases.setMaxListeners
, getMaxListeners
, prependListener
and
prependOnceListener
methods are not available.fn.bind
.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.
$ npm install --save eventemitter3
Recommended CDN:
https://unpkg.com/eventemitter3@latest/dist/eventemitter3.umd.min.js
After installation the only thing you need to do is require the module:
var 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
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.
var EE = new EventEmitter() , context = { foo: 'bar' }; function emitted() { console.log(this === context); // true } EE.once('event-name', emitted, context); EE.on('another-event', emitted, context); EE.removeListener('another-event', emitted, context);
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
.
Composable Charting Library based on reusable D3.js components.
A collection of components for React, base on bootstrap 4.0.
Blazing fast Apple TV application development using pure JavaScript
Foundation Apps components built with React
Browser based music making application driving synthesizers, samplers and effects using both a tracker and piano roll/loop based interface. Supports MIDI controllers and provides both local and cloud based project storage.