From 62c4b4c85ba94926f04028a8bb92168ef8e6c65c Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sat, 20 Nov 2021 12:55:05 -0800 Subject: [PATCH] lib: add AbortSignal.timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs: https://github.com/whatwg/dom/pull/1032 Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/40899 Reviewed-By: Michaƫl Zasso Reviewed-By: Matteo Collina --- doc/api/globals.md | 11 ++++ lib/internal/abort_controller.js | 85 ++++++++++++++++++++++++++- test/parallel/test-abortcontroller.js | 81 ++++++++++++++++++++++++- 3 files changed, 174 insertions(+), 3 deletions(-) diff --git a/doc/api/globals.md b/doc/api/globals.md index 15f82eff482be3..3e47237714f306 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -104,6 +104,17 @@ changes: Returns a new already aborted `AbortSignal`. +#### Static method: `AbortSignal.timeout(delay)` + + + +* `delay` {number} The number of milliseconds to wait before triggering + the AbortSignal. + +Returns a new `AbortSignal` which will be aborted in `delay` milliseconds. + #### Event: `'abort'`