Base class for objects that dispatches events.
var emitter = new EventEmitter();emitter.on('myEvent', function(evt){ console.log(evt.message);});emitter.emit({ type: 'myEvent', message: 'Hello world!'});
Emit an event.
emitter.emit({ type: 'myEvent', customData: 123});
The self object, for chainability.
Check if an event listener is added
Remove an event listener
emitter.on('myEvent', handler); // Add handleremitter.off('myEvent', handler); // Remove handler
Add an event listener
emitter.on('myEvent', function(evt){ console.log('myEvt was triggered!');});
Base class for objects that dispatches events.