0
里面我有一个递归函数:如何等待回调递归函数
let main =() => {
ftp(_defaultPath, _start, (file, doc, name) => {
parser(file, doc, name)
})
}
分析器功能:
module.exports = async function (file, doc, name) {
await funcOne(file, doc)
await funcTwo(file, doc, name)
await funcThree(file, doc, name)
}
回调其称为递归函数内多次:
async function myFuntion(path, name, callback) {
...
callback(file, doc, files[p][1])
...
}
问题是我想等待,当我做回调如:
async function myFuntion(path, name, callback) {
...
await callback(file, doc, files[p][1])
... next lines need to wait to finish callback
}
我试图找到如何做到这一点。
这可能吗?谢谢
谢谢!只是我找到了解决方案:D – user2634870