title: JQuery Deferred. Using $.when and .progress()
body: <p>I am writing a parser littered with Async Tasks.  I use JQuery promises to control and order the async tasks.  This is a psuedo code version of the constructor function:</p>
  
  <pre><code>   /**
       * @constructor
       */
      function Parser(json)
      {   
          return $.when(
              this.delete().then(this.insert(json)),
              this.doSomething(),
              this.doSomethingElse().then(this.update(json))
          ) 
      };
  </code></pre>
  
  <p>and this is what an example function looks like:</p>
  
  <pre><code>Parser.prototype.doSomething = function()
  {   
      var dfd = $.Deferred();
  
      exampleTask(dfd.reject, dfd.resolve);
  
      return dfd.promise();
  };
  </code></pre>
  
  <p>From the JQuery docs:</p>
  
  <blockquote>
    <p>In the case where multiple Deferred objects are passed to jQuery.when,
    the method returns the Promise from a new "master" Deferred object
    that tracks the aggregate state of all the Deferreds it has been
    passed</p>
  </blockquote>
  
  <p>How can I use .progress() to notify anybody that cares about the overall progress of the Parser? 
   e.g.</p>
  
  <pre><code>var parser = new Parser(json);
  parser.progress(function(prog){console.log(prog});
  </code></pre>
  
  <p>Heres a fiddle with what I'm trying to do:
  <a href="http://jsfiddle.net/ashanova/RjULA/2/">http://jsfiddle.net/ashanova/RjULA/2/</a></p>