locked
Sending progress up the chain.

    Question

  • I am deeply nesting promises and need to send some progress that occurs up the chain.  Let's assume this:

    function longRunningAsync() {
      return new WinJS.Promise(function (c, e, p) {
        // eventually
        p('progress happened');
      });
    }
    
    function doWork() {
      var promises = files.map(function(file) {
        return longRunningAsync()
          .then(doSomethingElse)
          .then(doAnotherThing)
          .then(howAboutAnother);
        });
    
      return WinJS.Promise.join(promises);
    }
    
    function doAllWork() {
      doWork()
        .then(
          function onComplete() {
          },
          function onError() {
          },
          function onProgress() {
          }
        );
    }
    I would expect the progress that occurs at the top to float all the way to the bottom but it does not. How do I achieve this sort of thing?

    Monday, July 9, 2012 11:37 PM

Answers

All replies