I need to return a boolean from a function t, like this:
function(t){
//Do Something
return resultBool;
}
But I when I have an async function (CasperJS) that determines the outcome, how would I do this using a callback? I tried something like this, but it doesnt seem to work (I think the function is simply returning the return value of t.withFrame, which is always true).
function(t){
function findElementInFrame(callback)
{
try{
t.withFrame("etravelframe", function(){
if(t.exists('#outFlight1------') == true){
callback(true);
}
else{
callback(false);
}
});
} catch(err){
//return false;
}
}
return findElementInFrame(function(bool){return bool;});
}