3 回答
TA貢獻1804條經驗 獲得超2個贊
是這樣嗎?
是
有沒有人考慮過以這種方式構建鏈的記憶問題?
Promise.eachthen
記憶消耗在承諾庫之間會有所不同嗎?
是的,非常重要。
TA貢獻1765條經驗 獲得超5個贊
thencatchcatch
function foo() {
function doo() {
// always return a promise
if (/* more to do */) {
return doSomethingAsync().then(function(){
throw "next";
}).catch(function(err) {
if (err == "next") doo();
})
} else {
return Promise.resolve();
}
}
return doo(); // returns a promise}添加回答
舉報
