3 ms·
> 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 updat
by 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.