Create new event with emitter object to simplify code

This commit is contained in:
Daniel Imms
2022-10-01 08:45:40 -07:00
parent 969db2bcf9
commit ed15a8e170
33 changed files with 247 additions and 307 deletions
+3 -4
View File
@@ -4,7 +4,7 @@
* @license MIT
*/
import { EventEmitter, IEvent } from 'common/EventEmitter';
import { initEvent, EventEmitter, IEvent } from 'common/EventEmitter';
declare const setTimeout: (handler: () => void, timeout?: number) => void;
@@ -42,8 +42,7 @@ export class WriteBuffer {
private _syncCalls = 0;
private _didUserInput = false;
private readonly _onWriteParsed = new EventEmitter<void>();
public readonly onWriteParsed = this._onWriteParsed.event;
public readonly onWriteParsed = initEvent<void>();
constructor(private _action: (data: string | Uint8Array, promiseResult?: boolean) => void | Promise<boolean>) { }
@@ -237,6 +236,6 @@ export class WriteBuffer {
this._pendingData = 0;
this._bufferOffset = 0;
}
this._onWriteParsed.fire();
this.onWriteParsed.fire();
}
}