I need to call a function after async.forEachOfSeries completes it's task. I have an Object named rows
. It contains postId
and other information. I need to make a request inside the funtion abc()
to get comments of that particular post and save them in database. If crawling is done then I call callback()
to make request for the next post in rows
. When loop is finished, I need to call the function xyz()
. Here's a sample code:
function loopTest(){
async.forEachOfSeries(rows, function (que, key, callback) {
function abc(){
//make request to facebookto get comments and stores in database
}
if(!commentCrawlingDone)
{
abc();
}
else{
callback();
}
});
xyz();
}