Asynchronous for cycle in JavaScript

前端 未结 13 1233
温柔的废话
温柔的废话 2020-11-22 11:37

I need a loop that waits for an async call before continuing. Something like:

for ( /* ... */ ) {

  someFunction(param1, praram2, function(result) {

    //         


        
13条回答
  •  耶瑟儿~
    2020-11-22 11:46

    Also look at this splendid library caolan / async. Your for loop can easily be accomplished using mapSeries or series.

    I could post some sample code if your example had more details in it.

提交回复
热议问题