import { EventEmitter } from 'events';
class MyClass extends EventEmitter {
constructor() {
super();
}
}
function onSomeEvent(data) {
console.log('Received data:', data);
}
class MyClass extends EventEmitter {
constructor() {
super();
this.on('someEvent', onSomeEvent);
}
}
class MyClass extends EventEmitter {
constructor() {
super();
}
someMethod() {
this.emit('someEvent', { some: 'data' });
}
}