【问题标题】:Recursion inside Async异步内部的递归
【发布时间】:2013-12-26 11:23:12
【问题描述】:

在下面的代码中,InsertIntoDB 是一个递归函数。问题是在一次调用 InsertIntoDB 后它执行 mainFn。我想在 InsertIntoDB 完全结束后执行 mainFn。

这是我的代码:

async.series([
    function(callback) {
        insertIntoDB(obj);
        callback();
    },
    function(callback) {
        mainFn();
        callback();
    }
]);

【问题讨论】:

标签: javascript asynchronous recursion


【解决方案1】:

也许如果你使用异步瀑布代替

https://github.com/caolan/async#waterfall

【讨论】:

    猜你喜欢
    • 2013-12-07
    • 2021-03-20
    • 1970-01-01
    • 2011-09-20
    • 1970-01-01
    • 2021-07-11
    • 1970-01-01
    • 1970-01-01
    • 2021-08-28
    相关资源
    最近更新 更多