有了承诺,我可以链中的功能类似于如下承诺行为:效仿“然后”与RxJS
var p = promiseFactory('1');
p.then(function(data){
/*Do something*/
return promiseFactory('2');
}).then(function(data){
/*Do something else*/
return value;
}).catch(function(err){
/*Here I can catch all exceptions threw in then methods*/
});
我可以渲染RxJS和可观察到这种行为如果是的话,怎么样?
您可以使用'.flatMap'。其实这取决于你想解决的问题。 –