summaryrefslogtreecommitdiff
path: root/cli/js/web/streams/writable_stream_default_controller.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-07-19 19:49:44 +0200
committerGitHub <noreply@github.com>2020-07-19 19:49:44 +0200
commitfa61956f03491101b6ef64423ea2f1f73af26a73 (patch)
treec3800702071ca78aa4dd71bdd0a59a9bbe460bdd /cli/js/web/streams/writable_stream_default_controller.ts
parent53adde866dd399aa2509d14508642fce37afb8f5 (diff)
Port internal TS code to JS (#6793)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Diffstat (limited to 'cli/js/web/streams/writable_stream_default_controller.ts')
-rw-r--r--cli/js/web/streams/writable_stream_default_controller.ts68
1 files changed, 0 insertions, 68 deletions
diff --git a/cli/js/web/streams/writable_stream_default_controller.ts b/cli/js/web/streams/writable_stream_default_controller.ts
deleted file mode 100644
index 960060b8f..000000000
--- a/cli/js/web/streams/writable_stream_default_controller.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-
-import {
- AbortAlgorithm,
- CloseAlgorithm,
- isWritableStreamDefaultController,
- Pair,
- resetQueue,
- SizeAlgorithm,
- WriteAlgorithm,
- writableStreamDefaultControllerClearAlgorithms,
- writableStreamDefaultControllerError,
-} from "./internals.ts";
-import * as sym from "./symbols.ts";
-import type { WritableStreamImpl } from "./writable_stream.ts";
-import { customInspect } from "../console.ts";
-import { setFunctionName } from "../util.ts";
-
-export class WritableStreamDefaultControllerImpl<W>
- implements WritableStreamDefaultController {
- [sym.abortAlgorithm]: AbortAlgorithm;
- [sym.closeAlgorithm]: CloseAlgorithm;
- [sym.controlledWritableStream]: WritableStreamImpl;
- [sym.queue]: Array<Pair<{ chunk: W } | "close">>;
- [sym.queueTotalSize]: number;
- [sym.started]: boolean;
- [sym.strategyHWM]: number;
- [sym.strategySizeAlgorithm]: SizeAlgorithm<W>;
- [sym.writeAlgorithm]: WriteAlgorithm<W>;
-
- private constructor() {
- throw new TypeError(
- "WritableStreamDefaultController's constructor cannot be called.",
- );
- }
-
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- error(e: any): void {
- if (!isWritableStreamDefaultController(this)) {
- throw new TypeError("Invalid WritableStreamDefaultController.");
- }
- const state = this[sym.controlledWritableStream][sym.state];
- if (state !== "writable") {
- return;
- }
- writableStreamDefaultControllerError(this, e);
- }
-
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- [sym.abortSteps](reason: any): PromiseLike<void> {
- const result = this[sym.abortAlgorithm](reason);
- writableStreamDefaultControllerClearAlgorithms(this);
- return result;
- }
-
- [sym.errorSteps](): void {
- resetQueue(this);
- }
-
- [customInspect](): string {
- return `${this.constructor.name} { }`;
- }
-}
-
-setFunctionName(
- WritableStreamDefaultControllerImpl,
- "WritableStreamDefaultController",
-);