summaryrefslogtreecommitdiff
path: root/cli/js/streams/transform-stream-default-controller.ts
diff options
context:
space:
mode:
authorNick Stott <nick@nickstott.com>2019-10-28 12:41:36 -0400
committerRy Dahl <ry@tinyclouds.org>2019-10-28 12:41:36 -0400
commit65d9286203cf239f68c6015818e82e8521e600a1 (patch)
tree0af1a7be449036f2f4ae9d3ecf06b7d645c8bddc /cli/js/streams/transform-stream-default-controller.ts
parent967c236fa5fb1e87e1b5ee788fe77d3a07361da1 (diff)
Re-enable basic stream support for fetch bodies (#3192)
* Add sd-streams from https://github.com/stardazed/sd-streams/blob/master/packages/streams/src/ * change the interfaces in dom_types to match what sd-streams expects
Diffstat (limited to 'cli/js/streams/transform-stream-default-controller.ts')
-rw-r--r--cli/js/streams/transform-stream-default-controller.ts58
1 files changed, 58 insertions, 0 deletions
diff --git a/cli/js/streams/transform-stream-default-controller.ts b/cli/js/streams/transform-stream-default-controller.ts
new file mode 100644
index 000000000..24a8d08fd
--- /dev/null
+++ b/cli/js/streams/transform-stream-default-controller.ts
@@ -0,0 +1,58 @@
+// TODO reenable this code when we enable writableStreams and transport types
+// // Forked from https://github.com/stardazed/sd-streams/tree/8928cf04b035fd02fb1340b7eb541c76be37e546
+// // Copyright (c) 2018-Present by Arthur Langereis - @zenmumbler MIT
+
+// /**
+// * streams/transform-stream-default-controller - TransformStreamDefaultController class implementation
+// * Part of Stardazed
+// * (c) 2018-Present by Arthur Langereis - @zenmumbler
+// * https://github.com/stardazed/sd-streams
+// */
+
+// import * as rs from "./readable-internals.ts";
+// import * as ts from "./transform-internals.ts";
+// import { ErrorResult } from "./shared-internals.ts";
+
+// export class TransformStreamDefaultController<InputType, OutputType>
+// implements ts.TransformStreamDefaultController<InputType, OutputType> {
+// [ts.controlledTransformStream_]: ts.TransformStream<InputType, OutputType>;
+// [ts.flushAlgorithm_]: ts.FlushAlgorithm;
+// [ts.transformAlgorithm_]: ts.TransformAlgorithm<InputType>;
+
+// constructor() {
+// throw new TypeError();
+// }
+
+// get desiredSize(): number | null {
+// if (!ts.isTransformStreamDefaultController(this)) {
+// throw new TypeError();
+// }
+// const readableController = this[ts.controlledTransformStream_][
+// ts.readable_
+// ][rs.readableStreamController_] as rs.SDReadableStreamDefaultController<
+// OutputType
+// >;
+// return rs.readableStreamDefaultControllerGetDesiredSize(readableController);
+// }
+
+// enqueue(chunk: OutputType): void {
+// if (!ts.isTransformStreamDefaultController(this)) {
+// throw new TypeError();
+// }
+// ts.transformStreamDefaultControllerEnqueue(this, chunk);
+// }
+
+// error(reason: ErrorResult): void {
+// if (!ts.isTransformStreamDefaultController(this)) {
+// throw new TypeError();
+// }
+// ts.transformStreamDefaultControllerError(this, reason);
+// }
+
+// terminate(): void {
+// if (!ts.isTransformStreamDefaultController(this)) {
+// throw new TypeError();
+// }
+// ts.transformStreamDefaultControllerTerminate(this);
+// }
+// }