add support for aborting via AbortController
- 主要语言
- JavaScript
- 星标
- 5.7k
- 派生
- 204
- PR 合并指标
- 30 天内没有已合并 PR
描述
https://developers.google.com/web/updates/2017/09/abortable-fetch
Currently it is only implemented in Firefox 57 and is coming to other browsers soon.
```javascript
const controller = new AbortController();
const signal = controller.signal;
setTimeout(() => controller.abort(), 5000);
fetch(url, { signal }).then(response => {
return response.text();
}).then(text => {
console.log(text);
});
```
Will most likely need to implement another npm package that just include `AbortController` package. I found one but it also pollyfills fetch. https://github.com/mo/abortcontroller-polyfill
贡献指南
这个仓库没有索引到贡献指南
调研方向
该 issue 未指定任何文件或测试。先阅读现有的 fetch 实现和 npm 依赖项,然后对比链接的 AbortController polyfill;当 fetch API 接受所示的 signal,并且 abort 它会产生预期的取消行为时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- api
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100