Skip to content

Instantly share code, notes, and snippets.

@veyselsahin
Created May 31, 2017 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veyselsahin/61645392a51efb78c2994f5fb4417db1 to your computer and use it in GitHub Desktop.
Save veyselsahin/61645392a51efb78c2994f5fb4417db1 to your computer and use it in GitHub Desktop.
async.parallel([
function(callback){
setTimeout(function(){
callback(null, 'one');
}, 200);
},
function(callback){
setTimeout(function(){
callback(null, 'two');
}, 100);
}
],
function(err, results){
// sonuc dizisi bu sekilde olacak ['one','two']
});
// bu ornekte dizi yerine nesne kullaniliyor
async.parallel({
one: function(callback){
setTimeout(function(){
callback(null, 1);
}, 200);
},
two: function(callback){
setTimeout(function(){
callback(null, 2);
}, 100);
}
},
function(err, results) {
// sonuc: {one: 1, two: 2}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment