Skip to content

Commit 159ed2b

Browse files
committed
fixes ignored readable event in WrappingIterator
1 parent 555d88e commit 159ed2b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

asynciterator.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2038,13 +2038,17 @@ export class WrappingIterator<T> extends AsyncIterator<T> {
20382038
this._source._destination = this;
20392039
this._source.on('end', destinationClose);
20402040
this._source.on('error', destinationEmitError);
2041-
this._source.on('readable', () => this.emit('readable'));
20422041
this._source.on('readable', destinationSetReadable);
20432042
this.readable = true;
20442043
}
20452044

20462045
read(): T | null {
2047-
return this._source ? this._source.read() : null;
2046+
let item = null;
2047+
if (this._source)
2048+
item = this._source.read();
2049+
if (!item)
2050+
this.readable = false;
2051+
return item;
20482052
}
20492053

20502054
protected _end(destroy: boolean = false) {

0 commit comments

Comments
 (0)