-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebAPI: fetch #187
Comments
二、
|
|
一、
fetch
函数1.1 语法
形参同
Request
本质上也是通过实参创建
Request
实例,即:等价于:
fetch
返回值Promise被rejectFetch_API里提到:
即只有当网络请求不能完成时才会
reject
,如:CORS
预检失败1.2 fetch & timeout
fetch
没有超时配置。一般通过Promsie.race
进行处理。也有利用
Promise.then
处理的:1.3 中断
fetch
请求如何取消异步操作
1.4 PK
XMLHttpRequest
MDN fetch API:
fetch
没有超时API,而XMLHttpRequest
有;好吧已经讨论了
Fetch 永生
Why I still use XHR instead of the Fetch API
MDN Using Fetch也在讨论了
1.5 APIs
fetch
函数只是Fetch 系列 API之一。Request
和Response
不只是只能应用在fetch
,他们比较一般化,可以应用在其他处理Request
,Response
的场景(如SW里所有的请求和响应都是Request
和Response
)。参考:
The text was updated successfully, but these errors were encountered: