node.js async series function's arguments

前端 未结 4 1981
夕颜
夕颜 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

    It can be as follows

    function taskFirst(k, v) {
        console.log(k, v);
    }
    
    function taskSecond(k, v) {
        console.log(k, v);
    }
    
    async.series([
        function(callback) { 
            callback(null, taskFirst(g1, g2));
        },
        function(callback) { 
            callback(null, taskFirst(g3, g4));
        }
    ],function(error, result){
    
    });
    

提交回复
热议问题