@rainbow-labs/rainbow-events
v1.1.1
Published
Rainbow Events
Downloads
1
Readme
Rainbow Events
Simple Typescript Event Emitter implementation
Example
import EventEmitter from '@rainbow-labs/rainbow-events';
class Person extends EventEmitter {
private name : string;
constructor(name : string) {
super();
this.name = name;
}
talk() : void {
this.emit('talk', 'my', 'name', 'is', this.name);
}
}
const Lina = new Person('Lina');
lina.on('talk', (...arguments) => {
console.log(arguments.join(' '));
});
lina.talk();
lina.off('talk');