Create new event with emitter object to simplify code
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user