首页 > 其他 > 详细

Asynchronous method in while loop

时间:2019-12-19 21:29:57      阅读:75      评论:0      收藏:0      [点我收藏+]

Asynchronous method in while loop

 

https://stackoverflow.com/questions/43064719/javascript-asynchronous-method-in-while-loop

 

 

let taskPool = new Promise(function(resolve, reject) {
resolve("Success!");
});
let that = this;
while (index < this.totalPieces) {
end = start + thisPartSize;
if (end > filesize) {
end = filesize;
thisPartSize = filesize - start;
}
taskPool.then(() => {
that.worker(start, end, index, thisPartSize);
});
index++;
start = end;
}

 

Asynchronous method in while loop

原文:https://www.cnblogs.com/yuanjiangw/p/12069845.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!