I am using custom triggered events after asynchronous calls happen, and I need a way to determine when they've ALL been triggered.
For example:
var ajaxFunction1 = function(){
    $.ajax({
        url: "someUrl.html",
        complete: function(){
            //Ok, all done
            $(document).trigger('ajaxFunction1Finished')
        }
    })
}
var ajaxFunction2 = function(){
    $.ajax({
        url: "someUrl.html",
        complete: function(){
            //Ok, all done
            $(document).trigger('ajaxFunction2Finished')
        }
    })
}
var ajaxFunction3 = function(){
    $.ajax({
        url: "someUrl.html",
        complete: function(){
            //Ok, all done
            $(document).trigger('ajaxFunction3Finished')
        }
    })
}
ajaxFunction1();
ajaxFunction2();
ajaxFunction3();
jQuery
   .when( /* Whenever $(document) receives those three events */ )
   .done(function(){
      //Do something
   })
Is this possible? I'd like to avoid triggering new events just to get a return true.
 
     
    