码迷,mamicode.com
首页 > 其他好文 > 详细

Asynchronous method in while loop

时间:2019-12-19 21:18:34      阅读:67      评论:0      收藏:0      [点我收藏+]

标签:func   this   tps   ack   start   stack   word   The   file   

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

标签:func   this   tps   ack   start   stack   word   The   file   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!