javascript-tutorial / javascript-tutorial/en.javascript.info

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

未關閉 適合新手
#3,988 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
HTML
星號
25.5k
分支
4k
PR 合併指標
30 天內沒有已合併 PR

描述

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.

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

開啟 5-network/04-fetch-abort/article.md 並閱讀手動 timeout 範例,尤其是 try..catch 區塊。緊接著在其後新增提議的 AbortSignal.timeout() 子章節,展示簡寫形式並說明 TimeoutError 與 AbortError 之間的差異。當文章清楚涵蓋這兩種 timeout 方法時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
javascript
領域
documentation
Issue 類型
文件
難度
1/5
預估耗時
1-3 小時
活躍度
冷清
描述清晰度
描述清楚
新手友好度
88/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。