From 413e3985186bf8545ab0e980a646e0fcd73b37f5 Mon Sep 17 00:00:00 2001 From: atlowChemi Date: Tue, 2 May 2023 17:06:56 +0300 Subject: [PATCH] lib: implement AbortSignal.any() --- doc/api/globals.md | 13 ++ lib/internal/abort_controller.js | 73 ++++++- lib/internal/validators.js | 21 +- test/fixtures/wpt/README.md | 2 +- .../wpt/dom/abort/abort-signal-any.any.js | 4 + .../abort/resources/abort-signal-any-tests.js | 185 ++++++++++++++++++ test/fixtures/wpt/versions.json | 2 +- 7 files changed, 287 insertions(+), 13 deletions(-) create mode 100644 test/fixtures/wpt/dom/abort/abort-signal-any.any.js create mode 100644 test/fixtures/wpt/dom/abort/resources/abort-signal-any-tests.js diff --git a/doc/api/globals.md b/doc/api/globals.md index 306d800dbdfd47..c9b2326c4039c1 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -121,6 +121,18 @@ added: Returns a new `AbortSignal` which will be aborted in `delay` milliseconds. +#### Static method: `AbortSignal.any(signals)` + + + +* `signals` {Array} The `AbortSignal`s of which to compose a new `AbortSignal`. + +Returns a new `AbortSignal` which will be aborted if any of the provided +signals are aborted. Its [`abortSignal.reason`][] will be set to whichever +one of the `signals` caused it to be aborted. + #### Event: `'abort'`