javascript - In async.until(test, function, callback) test function is not getting invoked repetitively -


while using async.until() function observed test not getting invoked repetitively though returning false. result function not getting invoked perform next task.

var resultreceived = false; async.until(function(){     console.log("checking result : "+resultreceived);             return resultreceived; }, function(callback){    try{        //do        resultreceived = true;    }catch(err){        resultreceived = false;    } }, function(result){             console.log("====================");             console.log(result);             callback(result); }); 

the reason see test function invoked once because never advance past first iteration. in order move 1 iteration next, need invoke callback in second function pass async.until.

here modified example show test function being invoked each iteration:

var iteration = 0; async.until(function(){     console.log("checking iteration : " + iteration);     return iteration > 5; }, function(callback){   console.log(++iteration);   settimeout(callback, 1000); }, function(result){     console.log("====================");     console.log(result); }); 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -