-
-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Description
Section/Content To Improve
Section/Content To Improve
The examples folder currently lacks a clear, practical example demonstrating how to cancel ongoing HTTP requests using the modern AbortController API.
Suggested Improvement
I would like to propose adding a new example file /examples/abort-controller/index.html (or similar) that demonstrates:
- How to cancel a single request using AbortController
- How to cancel multiple concurrent requests
- Proper cleanup and error handling when a request is aborted
- Real-world use case: canceling a request when a user navigates away or performs a new search
Motivation
Request cancellation is a common requirement in modern web applications, especially for:
- Search-as-you-type functionality
- Preventing race conditions
- Improving performance by canceling unnecessary requests
- Better user experience when navigating between pages
While the documentation mentions AbortController support, a practical example would greatly help developers implement this feature correctly.
Additional Context
I'm happy to contribute a PR for this example if the maintainers agree it would be a valuable addition to the examples collection.
Suggested Improvement
Add a comprehensive example demonstrating request cancellation using AbortController API with practical use cases like search-as-you-type and handling race conditions.