Fixed error with listening for other events

This commit is contained in:
smac89
2017-08-05 12:39:23 -06:00
parent 8c615091f0
commit 7d16e3c80d
2 changed files with 9 additions and 1 deletions
+5 -1
View File
@@ -20,6 +20,9 @@ interface Merge2Stream extends NodeJS.ReadWriteStream {
*/
add(...args: Array<StreamType | StreamType[]>): Merge2Stream;
on(event: string, listener: (...args: any[]) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
/**
* @summary It will emit 'queueDrain' when all streams merged.
* If you set end === false in options, this event give you a notice that
@@ -29,7 +32,8 @@ interface Merge2Stream extends NodeJS.ReadWriteStream {
*
* @return This stream
*/
on(event: 'queueDrain', callback: () => void): this;
on(event: 'queueDrain', listener: () => void): this;
once(event: 'queueDrain', listener: () => void): this;
}
/**
+4
View File
@@ -32,6 +32,10 @@ stream.add(stream4, stream5);
// ..
stream.end();
stream.on('data', (data: any) => {
console.log(data);
});
// equal to merge2([stream1, stream2], stream3)
stream = merge2();
stream.add([stream1, stream2]);