提交 185308c0 编写于 作者: A Alex Dima

Fix issue where BufferedEmitter would not deliver buffered events

上级 0cf92dcf
...@@ -420,7 +420,7 @@ export class BufferedEmitter<T> { ...@@ -420,7 +420,7 @@ export class BufferedEmitter<T> {
// it is important to deliver these messages after this call, but before // it is important to deliver these messages after this call, but before
// other messages have a chance to be received (to guarantee in order delivery) // other messages have a chance to be received (to guarantee in order delivery)
// that's why we're using here nextTick and not other types of timeouts // that's why we're using here nextTick and not other types of timeouts
process.nextTick(() => this._deliverMessages); process.nextTick(() => this._deliverMessages());
}, },
onLastListenerRemove: () => { onLastListenerRemove: () => {
this._hasListeners = false; this._hasListeners = false;
...@@ -443,7 +443,11 @@ export class BufferedEmitter<T> { ...@@ -443,7 +443,11 @@ export class BufferedEmitter<T> {
public fire(event: T): void { public fire(event: T): void {
if (this._hasListeners) { if (this._hasListeners) {
this._emitter.fire(event); if (this._bufferedMessages.length > 0) {
this._bufferedMessages.push(event);
} else {
this._emitter.fire(event);
}
} else { } else {
this._bufferedMessages.push(event); this._bufferedMessages.push(event);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册