title: How to use jQuery Deferred with custom events?
body: <p>I have two abstracted processes (e.g. managed within js objects using the revealing module pattern that do not expose their internals) that fire <a href="http://api.jquery.com/trigger/" rel="noreferrer">custom events</a> when they complete.  I want to perform an action when both custom events have fired.</p>
  
  <p>The new <a href="http://api.jquery.com/category/deferred-object/" rel="noreferrer">Deferred</a> logic in jQuery 1.5 seems like it would be an ideal way to manage this, except that the when() method takes Deferred objects that return a promise() (or normal js objects, but then when() completes immediately instead of waiting, which is useless to me).</p>
  
  <p>Ideally I would like to do something like:</p>
  
  <pre><code>//execute when both customevent1 and customevent2 have been fired
  $.when('customevent1 customevent2').done(function(){
    //do something
  });
  </code></pre>
  
  <p>What would be the best way to marry these two techniques?</p>