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); } emit(eventName: keyof HandlerT, ...args: any[]) { for (let handler of this.handlers) { let fn: any = handler[eventName]; if (fn) { fn(...args); } } } }