本文介绍了是什么async.waterfall和async.series之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在异步的NodeJS模块:提供了2个类似的方法, async.waterfall async.series

The nodejs async module: https://github.com/caolan/async provides 2 similar methods, async.waterfall and async.series.

它们之间有什么区别呢?

What is the difference between them?

推荐答案

看来, async.waterfall 允许每个功能传递到下一个功能它的结果,而 async.series 通过所有结果到最后的回调。在一个较高的水平, async.waterfall 将是一个数据管道(给出2,乘以3是由17加2,和鸿沟),而 async.series 将是必须的顺序进行离散任务,但在其他方面是分开的。

It appears that async.waterfall allows each function to pass its results on to the next function, while async.series passes all results to the final callback. At a higher level, async.waterfall would be for a data pipeline ("given 2, multiply it by 3, add 2, and divide by 17"), while async.series would be for discrete tasks that must be performed in order, but are otherwise separate.

这篇关于是什么async.waterfall和async.series之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 17:42