質問

I have a set of functions that are independent of each other [each of them returns a value, each of these functions also accept parameters.] and I wish to run them in parallel. If i use async.parallel I wont have the liberty to catch the values. Is there a way to do this?

Thanks.

役に立ちましたか?

解決

Example of how to do this in CoffeeScript:

async = require "async"
fns = [
   (cb) -> cb 1
   (cb) -> cb 2
   (cb) -> cb 4
]

async.parallel fns, (results) ->
  console.log results
  # produces [1,2,4]
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top