rndme / download

file downloading using client-side javascript
MIT License
2.28k stars 417 forks source link

能否返回下载完成 #98

Closed chatterzhao closed 1 year ago

chatterzhao commented 4 years ago

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

chatterzhao commented 4 years ago

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

chatterzhao commented 4 years ago

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

wangbinxiang commented 3 years ago

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 1 year ago

Sorry, I don't understand the issue here.