Skip to content
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

[Feature Request] umi-request 好像不支持 onUploadProgress #3267

Closed
zjxpcyc opened this issue Sep 24, 2019 · 5 comments
Closed

[Feature Request] umi-request 好像不支持 onUploadProgress #3267

zjxpcyc opened this issue Sep 24, 2019 · 5 comments

Comments

@zjxpcyc
Copy link

zjxpcyc commented Sep 24, 2019

Background

不知道是 bug 还是 feature 。没有找到支持 onUploadProgress 事件的说明

Proposal

Additional context

@label-actions
Copy link

label-actions bot commented Sep 25, 2019

@chenjsh36 请看下。

@chenjsh36
Copy link
Contributor

onUploadProgress 事件我理解因为是 XMLHttpRequest.upload 里事件监听器中的 onprogress 事件。很遗憾,umi-request 是基于 fetch 而非 XMLHttpRequest 封装的请求库,本身并不支持 onUploadProgress、onDownloadProgress 这类原生能力。

为什么 umi-request 不选择 XMLHttpRequest ,具体的原因和讨论可以看传统 Ajax 已死,Fetch 永生,简单来说,相比设计粗糙、不关注分离、调用方式混乱的 XMLHttpRequest,我们选择了语法简洁、基于标准 Promise 实现的 Fetch ,在享用 fetch 带来的好处的同时,也接受了 fetch 带来的不足之处。

@zjxpcyc
Copy link
Author

zjxpcyc commented Sep 27, 2019

好像网上有 fetch 模拟 process 的实现 https://jakearchibald.com/2016/streams-ftw/

@stale
Copy link

stale bot commented Nov 26, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Nov 26, 2019
@stale stale bot closed this as completed Dec 3, 2019
@Hitotsubashi
Copy link

早知道我就用回原生的axios,失望

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants