javascript - Promises.all() tracking invidual tasks completion -
i'm using promise.all(tasks)
track overall completion of tasks executed in no particular order (which main aim). want track individual tasks completion, how do that?
nothing keeps attaching individual handlers awaiting them together:
let tasks = …; ([t, i] of tasks.entries()) t.then(res => { console.log("task "+i+" completed with", res); }, err => { console.log("task "+i+" failed because", err); }); promise.all(tasks).then(all => { console.log("all tasks completed"); }, err => { console.log("something failed"); });
Comments
Post a Comment