WIP on shimming streams in firefox
This commit is contained in:
parent
23c347175a
commit
f4f8332f96
5 changed files with 46 additions and 11 deletions
25
app/transformStream.js
Normal file
25
app/transformStream.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* global TransformStream */
|
||||
import { createReadableStreamWrapper } from '@mattiasbuelens/web-streams-adapter';
|
||||
import { TransformStream as TransformStreamPony } from 'web-streams-ponyfill';
|
||||
|
||||
const toNative = createReadableStreamWrapper(ReadableStream);
|
||||
|
||||
class TransformStreamLocal {
|
||||
constructor(transformer) {
|
||||
this.stream = new TransformStreamPony(transformer);
|
||||
this.local = true;
|
||||
}
|
||||
get nativeReadable() {
|
||||
return toNative(this.stream.readable);
|
||||
}
|
||||
get readable() {
|
||||
return this.stream.readable;
|
||||
}
|
||||
get writable() {
|
||||
return this.stream.writable;
|
||||
}
|
||||
}
|
||||
|
||||
export default (typeof TransformStream === 'function'
|
||||
? TransformStream
|
||||
: TransformStreamLocal);
|
Loading…
Add table
Add a link
Reference in a new issue