Proposal: AbortSignal.none() #1277
Labels
addition/proposal
New features or enhancements
needs implementer interest
Moving the issue forward requires implementers to express interest
topic: aborting
AbortController and AbortSignal
What problem are you trying to solve?
When writing a function that accepts an
AbortSignal
, I typically write a function that looks like this:Because
signal
is optional, I'd like a way to specify a default value that can be used throughout the function to indicate "this function is not aborted"What solutions exist today?
There are two solutions I've used so far, and both have proven error prone:
In both cases, the issue I've faced is that it's easy to forget to check if signal has been passed and so errors tend to show up later.
How would you solve it?
I'd create a new
AbortSignal.none()
method that would return anAbortSignal
that is not aborted and never will be. That way, I could write something like this:Anything else?
Thank you for reading. 😄
The text was updated successfully, but these errors were encountered: