-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating an already aborted AbortController #959
Comments
Do you need an |
Good question... I think either would work for the immediate case to be honest. |
I like |
It'd be good to describe your use cases here, especially if you can expand them to be environment-agnostic so that people understand when they might also be applicable in web application code. That'd help make the pitch for multi-implementer interest. |
The most recent use case I've seen this for is the easiest/clearest... It's in the context of an HTTP request in Node.js:
Very simple, and along the same lines as (for instance) |
Returns an aborted AbortSignal. Tests: web-platform-tests/wpt#28003. Fixes #959.
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:
or
The
abort
event would never trigger on such objects, which is perfectly fine. We already tell users to check theaborted
property before attachingabort
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.
The text was updated successfully, but these errors were encountered: