emittery
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Emittery is a simple and modern async event emitter that is used in both Node.js and the browser using a bundler. Emitting events asynchronously is significant for production code to minimize the quantity of synchronous operations for optimal performance.
Using Emittery is quite straightforward. First, you need to import the Emittery package and then utilize different methods on the new instance of Emittery according to your needs. For instance, you can create an event, subscribe to an event, unsubscribe from an event, emit an event, and so forth.
//installation
npm install emittery
// usage example
import Emittery from 'emittery';
const emitter = new Emittery();
emitter.on('π¦', data => {
console.log(data);
});
emitter.emit('π¦', 'π'); // this will trigger the 'console.log' in the 'on' listener above
For detailed usage and to understand all the available methods, you should refer to the API section on the GitHub page of the Emittery library.
Emittery's documentation is available directly in its README.md on the GitHub repository. The readme contains detailed information about the library's installation, usage, API, as well as related queries and debugging instructions. If you're developing with TypeScript, there's also a section with information about working with TypeScript with Emittery.