How to get XMLHttpRequest Promise progress
<p>I am using JS Promise to refactor our JS API. However I met a problem which stops me from going further.</p>

<p>Basically, one of our API is to issue a async GET request and download a large file.</p>

<p>So the usage of the API would like this:</p>

<pre><code>var callback = {
  success: function(data){...},
  failure: function(data){...}
}    

Test(token).download(url).then(callback.success, callback.failure);
</code></pre>

<p>The Test function makes a XHR request to the url and calls the callback functions in onload &amp; onerror event handlers.</p>

<p>The problem is during the download procedure, the UI needs to be refresh, i.e. the progress bar, which is handled in onprogress.</p>

<p>The callback.success will only be called once when the Promise is resolved. So how should I implement the UI refresh callback which should be called in onprogress event handler of the inner XHR component of Test function?</p>