rndme/download

能否返回下载完成

Closed this issue · 4 comments

就是知道下载完成还是没有,想对不同状态进行不同处理。
这个fork 版本到4.2更新,但是不支持 ISSUE,所以还是到这边来问一下

哦,好像知道了,当download 函数返回 true 的时候才成功

我 fork 了代码,**的朋友可以去我那边看看,修改了README.md https://github.com/chatterzhao/download

function download(url, cb, error) {
const xhr = Download(url);
console.log(xhr);
xhr.onprogress = event => {
if (event.lengthComputable) {
var loaded = parseInt((event.loaded / event.total) * 100);
console.log(loaded);
cb(loaded);
}
};
xhr.onerror = () => {
console.log(0);
error();
};
}

rndme commented

Sorry, I don't understand the issue here.