Description
The "Fetch: Abort" article excellently explains the mechanics of AbortController and demonstrates a manual timeout using
setTimeout(() => controller.abort(), 1000)
Since aborting fetches due to time constraints is a very common use case, it would be highly beneficial for learners to also see the modern AbortSignal.timeout() method.
Proposal
I propose adding a short subsection titled ### AbortSignal.timeout() immediately following the try..catch block of the manual timeout example. This section will demonstrate the shorthand syntax and note the important distinction that it throws a TimeoutError rather than an AbortError.
Description
The "Fetch: Abort" article excellently explains the mechanics of
AbortControllerand demonstrates a manual timeout usingSince aborting fetches due to time constraints is a very common use case, it would be highly beneficial for learners to also see the modern
AbortSignal.timeout()method.Proposal
I propose adding a short subsection titled
### AbortSignal.timeout()immediately following thetry..catchblock of the manual timeout example. This section will demonstrate the shorthand syntax and note the important distinction that it throws aTimeoutErrorrather than anAbortError.