- 5.1 Dissecting
Promise.all(): Implement your own version of
Promise.all()leveraging promises, async/await, or a combination of the two. The function must be functionally equivalent to its original counterpart.
TaskQueuewith promises: Migrate the
TaskQueueclass internals from promises to async/await where possible. Hint: you won't be able to use async/await everywhere.
- 5.3 Producer-consumer with promises: Update the
TaskQueuePCclass internal methods so that they use just promises, removing any use of the async/await syntax. Hint: the infinite loop must become an asynchronous recursion. Beware of the recursive
Promiseresolution memory leak!
- 5.4 An asynchronous
map(): Implement a parallel asynchronous version of
Array.map()that supports promises and a concurrency limit. The function should not directly leverage the
TaskQueuePCclasses we presented in this chapter, but it can use the underlying patterns. The function...