Skip to content

Latest commit

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

@eolthar/events

A lightweight, high-performance event emitter for fast and scalable projects.

npm i @eolthar/events

Benchmark

Category@eolthar/eventstseepEventEmitter3NanoEventsmitt
1. Mass subscription and emit4 151 9323 875 0263 225 1723 774 5873 276 026
2. Unsubscribe6 198 8896 286 9164 384 3817 885 6375 295 300
3. on → emit → off2 348 9372 727 9542 509 0483 543 0342 744 207
4. emit (0 arguments)10 397 6738 126 4186 837 4318 565 5916 764 343
5. emit (5 arguments)9 915 6388 080 3406 901 5307 531 2096 454 089
6. emit (10 arguments)9 183 7037 561 9474 503 8346 767 0506 023 215

Usage

The full API, with typed signatures and behavioural notes, is listed in the type declarations.

const{ Emitter }=require("@eolthar/events");// Create an emitterconstemitter=newEmitter();functionhandler(name){console.log(`Hello, ${name}!`);}// Subscribe to an eventemitter.on("hello",handler);// Emit an eventemitter.emit("hello","Alice");// Hello, Alice!// Unsubscribe from the eventemitter.off("hello",handler);// Emitting again won't call the listeneremitter.emit("hello","Bob");// nothing happens

License

MIT

About

A lightweight, high-performance event emitter for fast and scalable projects.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages