-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
精读《用 Reduce 实现 Promise 串行执行》 #109
Comments
额,串行执行不是直接下面这种方法就行的么? async function chuanxing(promises){
for(let i=0;i<promises.length;i++){
await promises[i];
}
} |
指的是没有 async 的场景 |
如果任务队列中的函数都依赖上一个返回值的函数改怎么写呢 |
|
复杂一点如,多个任务,得按照顺序来交互,每个任务又是异步,这个场景也能用到串行Promise |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
本周精读的文章是:why-using-reduce-to-sequentially-resolve-promises-works
Promise.all 可以并行解决处理所有异步 Promise,但 Promise 串行执行却没有现成的 API,本文推荐了
reduce
方式解决 Promise 串行执行的思路值得学习。The text was updated successfully, but these errors were encountered: