javascript - End of an async action inside _.each -
i have asynchronous action happening inside iterator function in _.each. there way call function after callback of asynchronous action ends.
_.each(a, function (a){ b(a, function (c, d) { // statements } } i want after items in callback function inside b has been finished. i'm using in node js server.
if understood well, want execute asynchronous function each item in array, , call function when async calls have finished. achieve this, should use async module:
async.each(arr, function(item, callback){ // asynchronous function executed every item in arr // call callback function when done callback(); , function(){ // executed after iterator functions have finished } please refer async documentation more details , examples.
Comments
Post a Comment