Skip to content

question about waterfall with setTimeout or process.nextTick #307

@enginespot

Description

@enginespot

code like the follows:
for the second function , it will be called after 1 second , so my question is how to pass the data 'three' to the next function

async.waterfall([
    function(callback){
        callback(null, 'one', 'two');
    },
    function(arg1, arg2, callback){
        setTimeout(callback.bind(null,"three"),1000);
//        callback(null, 'three');
    },
    function(arg1, callback){
        // arg1 now equals 'three'
        callback(null, 'done');
    }
], function (err, result) {
   // result now equals 'done'    
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions