相关疑难解决方法(0)

callback()或返回callback()

我可能不太了解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)

asynchronous node.js

33
推荐指数
1
解决办法
2万
查看次数

标签 统计

asynchronous ×1

node.js ×1