micro-events
A very, very simple event emitter implementation.
Features
- no dependencies
- very small (~ 80 LoC)
- smart memory leak detection
- lighting fast
- unopinionated and minimal
- works in the browser and on Node.JS
- checks arguments
- emits useful events
How can I use this?
var EventEmitter = ; var myEventEmitter = ; // Maximum number of listeners (used to prevent memory leaks and dumb code) // - defaults to 10 myEventEmittermaxListeners = 20; // Implement listener var { console; }; // Register onRun event listener myEventEmitter; ; ;
How can I extend this?
Just like you would extend any other "class".
var EventEmitter = ; var { EventEmitter; }; MyEventEmitterprototype = Object; MyEventEmitterprototypeconstructor = MyEventEmitter;
If possible, it is recommended to use/ mix in individual methods as opposed to extending the super class.