import { from } from '../asynciterable/from' ; import { publish } from './operators/publish' ; import { IterableX } from '../iterable/iterablex' ; import { toDOMStream as asyncIterableToDOMStream , ReadableBYOBStreamOptions , ReadableByteStreamOptions , } from '../asynciterable/todomstream' ; export function toDOMStream < T > ( source , strategy ? ) ; export function toDOMStream < T > ( source , options ) ; export function toDOMStream < T > ( source , options ) ; export function toDOMStream ( source , options ? ) { if ( ! options || ! ( 'type' in options ) || options [ 'type' ] !== 'bytes' ) { return asyncIterableToDOMStream ( from ( source ) , options ) ; } return asyncIterableToDOMStream ( from ( source ) , options ) ; } IterableX . prototype . tee = function < T > ( this ) { return _getDOMStream ( this ) . tee ( ) ; } ; IterableX . prototype . pipeTo = function < T > ( this , writable , options ? ) { return _getDOMStream ( this ) . pipeTo ( writable , options ) ; } ; IterableX . prototype . pipeThrough = function < T , R extends ReadableStream < any > > ( this , duplex , options ? ) { return _getDOMStream ( this ) . pipeThrough ( duplex , options ) ; } ; function _getDOMStream < T > ( self ) { return self . _DOMStream || ( self . _DOMStream = self . pipe ( publish < T > ( ) , toDOMStream ) ) ; } ignore export function toDOMStreamProto < T > ( this , strategy ? ) ; export function toDOMStreamProto < T > ( this , options ) ; export function toDOMStreamProto < T > ( this , options ) ; export function toDOMStreamProto ( this , options ? ) { return ! options ? toDOMStream ( this ) : toDOMStream ( this , options ) ; } IterableX . prototype . toDOMStream = toDOMStreamProto ; declare module '../iterable/iterablex' { interface IterableX < T > { toDOMStream : typeof toDOMStreamProto ; tee ( ) : [ ReadableStream < T > , ReadableStream < T > ] ; pipeTo ( writable , options ? ) : Promise < void > ; pipeThrough < R extends ReadableStream < any > > ( duplex , options ? ) : R ; } }