将参数传递给Node.js异步瀑布

时间:2012-10-27 04:18:22

标签: node.js asynchronous node-async

我需要将一些参数传递给async waterfall()的初始函数。建议的方法https://github.com/caolan/async/issues/14对我不起作用,因为我需要传递ExpressJS函数的响应

exports.categories = (req, res) ->
    async.waterfall [           
       (callback) ->
         # need req here...

2 个答案:

答案 0 :(得分:3)

async.apply()

async.waterfall([
  async.apply(function(req, callback) {}, req);
]);

答案 1 :(得分:1)

async.waterfall [
  ( (req, callback) ->

  ).bind(null, req)
]