我可能不太了解Node的事件循环.
假设我有一个foo包含异步函数的函数async_func.我有吗
//1
function foo(callback) {
//stuff here
async_func(function() {
//do something
callback();
});
//this eventually get executed
}
Run Code Online (Sandbox Code Playgroud)
要么
//2
function foo(callback) {
//stuff here
async_func(function() {
//do something
return callback();
});
//never executed
}
Run Code Online (Sandbox Code Playgroud)