From 448a6a22cf5ba0f719ea871c8137dc3e1b25fb63 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Wed, 10 Mar 2021 08:59:52 -0800 Subject: [PATCH] lib: implement AbortSignal.abort() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs: https://github.com/whatwg/dom/pull/960 PR-URL: https://github.com/nodejs/node/pull/37693 Backport-PR-URL: https://github.com/nodejs/node/pull/38386 Reviewed-By: Antoine du Hamel Reviewed-By: Michaƫl Zasso Reviewed-By: Benjamin Gruenbaum --- .eslintrc.js | 1 + doc/api/globals.md | 9 +++++++++ lib/internal/abort_controller.js | 8 ++++++-- test/parallel/test-abortcontroller.js | 5 +++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 8464945125b678..06711298a7f0b2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -283,6 +283,7 @@ module.exports = { }, globals: { AbortController: 'readable', + AbortSignal: 'readable', Atomics: 'readable', BigInt: 'readable', BigInt64Array: 'readable', diff --git a/doc/api/globals.md b/doc/api/globals.md index e92dd5fc47d732..a4d591a44fe9d8 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -65,6 +65,15 @@ added: REPLACEME The `AbortSignal` is used to notify observers when the `abortController.abort()` method is called. +#### Static method: `AbortSignal.abort()` + + +* Returns: {AbortSignal} + +Returns a new already aborted `AbortSignal`. + #### Event: `'abort'`