javascript-tutorial / javascript-tutorial/en.javascript.info
Proposal: Add `AbortSignal.timeout()` shorthand to "Fetch: Abort" article
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- HTML
- Sterne
- 25.5k
- Forks
- 4k
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Öffne 5-network/04-fetch-abort/article.md und lies das Beispiel für ein manuelles Timeout, insbesondere den try..catch-Block. Füge direkt danach den vorgeschlagenen Abschnitt zu AbortSignal.timeout() ein, der die Kurzform zeigt und den Unterschied zwischen TimeoutError und AbortError erklärt. Erledigt ist die Aufgabe, wenn der Artikel beide Timeout-Ansätze klar abdeckt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 1/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Ruhig
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 88/100