Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function main() {
- const a = computeA();
- const b = computeB(a); // Say: computeB takes promise in input.
- const c = go(async cb => computeC(await b, cb)); // Say: computeC doesn't understand promise.
- const d = computeD(a, c); // Say: computeD takes promise in input.
- const e = computeE(b); // etc.
- const f = go(async cb => computeF(await b, await c, cb));
- const g = computeG(d)
- const h = computeH(d, f);
- const i = computeI(g);
- const j = go(async cb => computeJ(await g));
- // Usually just await j is enough if that is the final result you are interested in.
- return Promises.all([a, b, c, d, e, f, g, h, i, j]).then((res) => {
- console.log("All done");
- }, (err) => {
- console.error(err);
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement