Skip to content

Proposal: Add AbortSignal.timeout() shorthand to "Fetch: Abort" article #3988

Description

@illia-m-b

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions