【发布时间】:2016-08-24 20:42:47
【问题描述】:
以下是我的情况
if abc is true
call async func1, func2
else
call async func1
function test(): Q.Promise<boolean> {
if(abc)
Q.all([func1,func2])
else
Q.all([func1])
//if failed throw reject reason all the way in the chain
}
- 如图所示,可以使用
if和else子句来完成,有没有更好的方法来有条件地调用promise? - 如何退回
error from any one of the promises?
【问题讨论】: