export abstract class EventEmitter { private handlers: Partial[] = []; on(handlers: Partial) { this.handlers.push(handlers); } off(handlers: Partial) { this.handlers = this.handlers.filter((h) => h !== handlers); } async emit(eventName: keyof HandlerT, ...args: any[]): Promise { for (const handler of this.handlers) { const fn: any = handler[eventName]; if (fn) { await Promise.resolve(fn(...args)); } } } }