diff --git a/src/EventEmitter.ts b/src/EventEmitter.ts index d05e3863..1db86763 100644 --- a/src/EventEmitter.ts +++ b/src/EventEmitter.ts @@ -11,7 +11,9 @@ export class EventEmitter { private _events: {[type: string]: ListenerType[]}; constructor() { - this._events = {}; + // Restore the previous events if available, this will happen if the + // constructor is called multiple times on the same object (terminal reset). + this._events = this._events || {}; } public on(type, listener): void {