Add support for AbortController/AbortSignal (#4757)

This commit is contained in:
Kitson Kelly 2020-04-16 00:10:49 +10:00 committed by GitHub
parent 95eb6d780c
commit cb64cf3ce2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 154 additions and 4 deletions

View file

@ -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,
});