Closed
Description
It would be useful (to me at least) if whilst could optionally accept an asynchronous test function. It would work by delegating to the normal whilst, just storing local state about the last outcome of the test. Something like this:
whilst: function(test, action, callback){
if(test.length > 0) newWhilst(test, action, callback)
else {
...
}
},
newWhilst: function(test, action, callback){
test(function(state){
whilst(function(){
return state;
},
function(callback){
action(function(){
test(function(result){
state = result;
callback();
});
});
},
callback);
});
},
Is there a reason this feature isn't implemented? If not I'd be happy to add it and submit a pull request
Metadata
Metadata
Assignees
Labels
No labels