callback() ou retour de rappel()

Il est possible que je ne comprends pas le Nœud de la boucle d'événement assez bien.

Dire que j'ai une fonction foo qui contient une fonction d'asynchrone async_func. Dois-je

//1
function foo(callback) {
       //stuff here
       async_func(function() {
            //do something
            callback();
       });
//this eventually get executed
}

ou

//2
function foo(callback) {
       //stuff here
       async_func(function() {
            //do something
            return callback();
       });
//never executed
}
InformationsquelleAutor Colin | 2013-08-13