mirror of
https://gitlab.com/timvisee/send.git
synced 2025-12-08 07:00:54 +03:00
WIP on shimming streams in firefox
This commit is contained in:
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);
|
||||
Reference in New Issue
Block a user