From a8362d89aba3eb1aef072c3c1ea64cb29966ab0d 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 Refs: https://github.com/whatwg/dom/pull/1032 Signed-off-by: James M Snell --- doc/api/globals.md | 11 +++++++++++ lib/internal/abort_controller.js | 26 ++++++++++++++++++++++++++ test/parallel/test-abortcontroller.js | 10 ++++++++++ 3 files changed, 47 insertions(+) diff --git a/doc/api/globals.md b/doc/api/globals.md index 88e9aad9df21f8..56b52e0efa5872 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)` + + + +* `duration` {number} The numer of milliseconds to wait before triggering + the AbortSignal. + +Returns a new `AbortSignal` which will be aborted in `delay` milliseconds. + #### Event: `'abort'`