diff options
Diffstat (limited to 'cli/js/web/abort_controller.ts')
-rw-r--r-- | cli/js/web/abort_controller.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cli/js/web/abort_controller.ts b/cli/js/web/abort_controller.ts new file mode 100644 index 000000000..5b0a3af3c --- /dev/null +++ b/cli/js/web/abort_controller.ts @@ -0,0 +1,23 @@ +// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. +import { AbortSignalImpl, signalAbort } from "./abort_signal.ts"; + +export class AbortControllerImpl implements AbortController { + #signal = new AbortSignalImpl(); + + get signal(): AbortSignal { + return this.#signal; + } + + abort(): void { + this.#signal[signalAbort](); + } + + get [Symbol.toStringTag](): string { + return "AbortController"; + } +} + +Object.defineProperty(AbortControllerImpl, "name", { + value: "AbortController", + configurable: true, +}); |