Created
October 29, 2018 23:43
-
-
Save abuzarhamza/03724d121f41bd410ba45a7bbbf97bff to your computer and use it in GitHub Desktop.
async
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let async = require('async'); | |
async.autoInject({ | |
a: test1.bind(null, 1), | |
b: test2.bind(null, 2), | |
c: ['b', (b , cb)=> { | |
test4.bind(null, 3)(cb); | |
}], | |
d: ['b', (b, cb)=> { | |
test4.call(null,3,cb) | |
}] | |
}, ()=> { | |
console.log('******************+++'); | |
}); | |
function test1(n, done) { | |
console.log('n1=?', n); | |
done(); | |
} | |
function test2(n, done) { | |
setTimeout(() => { | |
console.log('n2', n); | |
done(); | |
}, 2000); | |
} | |
function test4(n, done) { | |
setTimeout(() => { | |
console.log('n3', n); | |
//done(); | |
}, 4000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment