Answered by:
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
-
Hi,
I tried to combine the code on http://social.msdn.microsoft.com/Forums/en-CA/winappswithhtml5/thread/71beb208-c0b1-4b1b-937d-dae519304dc6 with your code, and it worked fine. I would like to suggest you to give it a try.
Best Regards,
Ming Xu.
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework- Marked as answer by MingXu-MSFTMicrosoft employee, Moderator Tuesday, July 17, 2012 3:54 AM
Tuesday, July 10, 2012 10:53 AMModerator
All replies
-
Seems like the problem might be with the WinJS.Promise.join call. Looks like you can't report progress if you use this function.Can someone at Microsoft confirm this?Tuesday, July 10, 2012 12:26 AM
-
Hi,
I tried to combine the code on http://social.msdn.microsoft.com/Forums/en-CA/winappswithhtml5/thread/71beb208-c0b1-4b1b-937d-dae519304dc6 with your code, and it worked fine. I would like to suggest you to give it a try.
Best Regards,
Ming Xu.
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework- Marked as answer by MingXu-MSFTMicrosoft employee, Moderator Tuesday, July 17, 2012 3:54 AM
Tuesday, July 10, 2012 10:53 AMModerator -
Hi,
I will mark the reply as an answer. If you find it no help, please feel free to unmark it and follow up.
Thanks.
Best Regards,
Ming Xu.
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code FrameworkTuesday, July 17, 2012 3:54 AMModerator