Edit in JSFiddle

/*
Putting the deferred objects into a parent object just to keep things tidy. Adding them to an array because that's what we're going to check against.

The array is populated manually here, but it could be filled programmatically with bunches of deferreds. No matter how many items are in the array, this will work. All of the deferred objects in the array need to be resolved before the final done function will run.

NOTE: Don't mix up the array. Everything in there needs to be a deferred object and nothing else.
*/

var objDFD = {
  one : $.Deferred(),
  two : $.Deferred(),
  three : $.Deferred(),
};
var arrDFD = [objDFD.one, objDFD.two, objDFD.three]

var objStuff = {
// done functions will add properties to objStuff.
}

/*

*/
objDFD.one.done(function() {
	$('#container').append('<p>objDFD.one is resolved.</p>');
  objStuff.one = true;
  
  // This function won't exist in the objStuff object until this deferred is resolved. Calling it early will get you a big old JavaScript error.
  objStuff.doThings = function() {
  	$('#container').append('<p>objStuff.one = ' + objStuff.one + '<br>objStuff.two = ' + objStuff.two + '<br>objStuff.three = ' + objStuff.three + '</p>');
  }
});
objDFD.two.done(function() {
	$('#container').append('<p>objDFD.two is resolved.</p>');
  objStuff.two = true;
});
objDFD.three.done(function() {
	$('#container').append('<p>objDFD.three is resolved.</p>');
  objStuff.three = true;
});

/*
The null value is for context. Usually when using the apply method you'll pass in a context, so the functions innards will have your chosen value for "this". For these purposes, that doesn't matter so a null value is passed in. Everything in the arrDFD array needs to be resolved before this will run.
*/
$.when.apply(null, arrDFD).done(function() {
	$('#container').append('<p>All of the deferred objects are resolved.</p>');
  /*
  This function doesn't exist until 'objDFD.one' is resolved, and the done function in there uses properties which aren't created until the other ones are resolved. If this function is called before absolutely everything is finished, then some things will come back in an error as undefined and you will have a sad.
  */
	objStuff.doThings();
});

// Resolving these puppies so we can see the results. The order doesn't matter.
objDFD.one.resolve();
objDFD.two.resolve();
objDFD.three.resolve();
<div id="container">
  <h2>Results below:</h2>
</div>