@johngw/stream
Version:
Reactive programming tools using the WHATWG Streams API.
29 lines • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ForkableStream = void 0;
const BaseForkableStream_1 = require("@johngw/stream/sinks/BaseForkableStream");
const ForkableSink_1 = require("@johngw/stream/sinks/ForkableSink");
/**
* A ForkableStream is "1 Writable to many Readables".
*
* @group Sinks
* @example
* ```
* const forkable = new ForkableStream<T>()
*
* fromCollection([1, 2, 3, 4, 5, 6, 7]).pipeTo(forkable)
*
* forkable.fork().pipeTo(write(x => console.info('fork1', x)))
* // fork1 1, fork1 2, fork1 3, fork1 4, fork1 5, fork1 6, fork1 7
*
* forkable.fork().pipeTo(write(x => console.info('fork2', x)))
* // fork2 1, fork2 2, fork2 3, fork2 4, fork2 5, fork2 6, fork2 7
* ```
*/
class ForkableStream extends BaseForkableStream_1.BaseForkableStream {
constructor(queuingStrategy) {
super(new ForkableSink_1.ForkableSink(), queuingStrategy);
}
}
exports.ForkableStream = ForkableStream;
//# sourceMappingURL=ForkableStream.js.map