= $.Deferred(); $.when(def1, def2).done(function(one, two){ //… do something with one and two; }); //… later def1.resolve(val); //… even later def2.resolve(val);
musDef); var promise2 = $.when(msgDef, bgDef); $.when(promise1, promise2).done(function(){ //… do something with anim, music message and background });