1min.

1MIN · PROGRAMMING LANGUAGES

AbortSignal combines cancellation and request timeouts

AbortSignal lets JavaScript code cancel a fetch request through an AbortController, impose a timeout, or combine several cancellation signals. The same mechanism can stop a download when a user changes their mind or a request takes too long. An aborted signal cannot be reset: later requests need a fresh signal rather than reusing it.

MDN Web Docs

Why it matters

Useful for frontend engineers making network-driven interfaces responsive when users navigate or cancel an operation.

More context

Evergreen reference material; original publication date is unverified. Try the fetch examples with explicit cancellation and AbortSignal.timeout, then use AbortSignal.any when either condition should stop the request. Handle cancellation separately from unexpected failures.

Keep in mind

Check support for each method in your target browsers. Cancelling a client request does not establish that a server-side operation was undone; design write operations accordingly.

Original read

More engineering ideas, one minute at a time.

Explore more stories