node.js async series function's arguments

前端 未结 4 1990
夕颜
夕颜 2021-02-20 06:49

I need to do the code like following:

function taskFirst(k, v) {
    console.log(k, v);
}

function taskSecond(k, v) {
    console.log(k, v);
}

function run() {         


        
4条回答
  •  天命终不由人
    2021-02-20 07:10

    This answer to async's github issue has worked for me perfectly. https://github.com/caolan/async/issues/241#issuecomment-14013467

    for you it would be something like:

    var taskFirst = function (k, v) {
       return function(callback){
          console.log(k, v);
          callback();
       }
    };
    

提交回复
热议问题