1 | import { from } from '../asynciterable/from';
|
2 | import { publish } from './operators/publish';
|
3 | import { IterableX } from '../iterable/iterablex';
|
4 | import { toDOMStream as asyncIterableToDOMStream } from '../asynciterable/todomstream';
|
5 | export function toDOMStream(source, options) {
|
6 | if (!options || !('type' in options) || options['type'] !== 'bytes') {
|
7 | return asyncIterableToDOMStream(from(source), options);
|
8 | }
|
9 | return asyncIterableToDOMStream(from(source), options);
|
10 | }
|
11 | IterableX.prototype.tee = function () {
|
12 | return _getDOMStream(this).tee();
|
13 | };
|
14 | IterableX.prototype.pipeTo = function (writable, options) {
|
15 | return _getDOMStream(this).pipeTo(writable, options);
|
16 | };
|
17 | IterableX.prototype.pipeThrough = function (duplex, options) {
|
18 | return _getDOMStream(this).pipeThrough(duplex, options);
|
19 | };
|
20 | function _getDOMStream(self) {
|
21 | return self._DOMStream || (self._DOMStream = self.pipe(publish(), toDOMStream));
|
22 | }
|
23 | export function toDOMStreamProto(options) {
|
24 | return !options ? toDOMStream(this) : toDOMStream(this, options);
|
25 | }
|
26 | IterableX.prototype.toDOMStream = toDOMStreamProto;
|
27 |
|
28 |
|