我有一个比较棘手的问题,找不到一个合适的答案。问题出在 Firebase 上,因为它不支持 await 和 async。
目前程序可以运行,但只会运行一次而无法循环。
return foo.bar(query);})
.then((result) => {
if (result == '0') {
//do stuff
}
else {
var i;
for(i = 0; i <= result; i++) {
return foo.bar(secondQuery);})
.then((secondResult) => {
//do other stuff
})
}
}
})
return
会在第一次迭代后终止函数。你想在那里实现什么? - CertainPerformance