3 ms·
Using promises is basically no different than using async functions, and definitely doesn't "uncolor" your functions. Any function that calls another that retu
by spankalee 2y ago
Using promises is basically no different than using async functions, and definitely doesn't "uncolor" your functions.
Any function that calls another that returns a Promise will have to return a Promise to represent completion correctly. That's the color.
- dragonwriter 2y ago> Any function that calls another that returns a Promise will have to return a Promise to represent completion correctly No, it doesn't, closures let you update values in the wcope of the parent in .then() callbacks and then you can loop in the function and wait for completion and return a non-Promise value.
- modal-soul 2y agoThis is not true. If your sync function loops until the value is set, then the Promise will never resolve, since it never yields to the event loop.