Emit an event.
The self object, for chainability.
emitter.emit({
type: 'myEvent',
customData: 123
});
Remove an event listener
The self object, for chainability.
emitter.on('myEvent', handler); // Add handler
emitter.off('myEvent', handler); // Remove handler
Add an event listener
The self object, for chainability.
emitter.on('myEvent', function(evt){
console.log('myEvt was triggered!');
});
Base class for objects that dispatches events.
Example