-
Notifications
You must be signed in to change notification settings - Fork 313
Closed
Labels
topic: abortingAbortController and AbortSignalAbortController and AbortSignal
Description
In Node.js, we have had a couple of use cases pop up recently with the need to mark an AbortController
already aborted immediately after creation. Typically, this would be done as: const ac = new AbortController(); ac.abort(); return ac;
.
It would be helpful to have a utility that makes this easier...
Either:
const ac = new AbortController({ aborted: true });
or
const ac = AbortController.aborted();
The abort
event would never trigger on such objects, which is perfectly fine. We already tell users to check the aborted
property before attaching abort
listeners.
If the idea seems reasonable, I can work up a PR with the change. I would just need to know which approach (init options vs. static factory function) is preferred.
Metadata
Metadata
Assignees
Labels
topic: abortingAbortController and AbortSignalAbortController and AbortSignal