samedi 4 avril 2015

Rewrite one of the async methods into one that uses promises


Vote count:

0




How can I rewrite my callback into promises that using async module? For example if I have the following code



async.parallel([
function(){ ... },
function(){ ... }
], callback);


or



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


asked 36 secs ago

nmrony

839






Rewrite one of the async methods into one that uses promises

Aucun commentaire:

Enregistrer un commentaire