3 回答
TA貢獻1829條經(jīng)驗 獲得超9個贊
是這樣嗎?
是
有沒有人考慮過以這種方式構(gòu)建鏈的記憶問題?
Promise.eachthen
記憶消耗在承諾庫之間會有所不同嗎?
是的,非常重要。
TA貢獻1827條經(jīng)驗 獲得超9個贊
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}添加回答
舉報
