javascript-tutorial / javascript-tutorial/en.javascript.info
Proposal: Add `AbortSignal.timeout()` shorthand to "Fetch: Abort" article
还没有人认领这个 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.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
打开 5-network/04-fetch-abort/article.md 并阅读手动超时示例,尤其是 try..catch 块。紧接着在其后添加提议的 AbortSignal.timeout() 小节,展示简写形式并解释 TimeoutError 与 AbortError 之间的区别。当文章清晰涵盖这两种超时方式时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 1/5
- 预计耗时
- 1-3 小时
- 活跃度
- 冷清
- 描述清晰度
- 描述清楚
- 新手友好度
- 88/100