最近在学习Rx,在网上看到一段话,讲了promise与ReactiveX的区别:
Simply put: A promise resolves to a single value asynchronously, an observable resolves to (or emits) multiple values asynchronously (over time).
Concrete examples:
Promise: Response from an Ajax callObservable: Click events
More information can be found here: http://reactivex.io/intro.html
i've read that observables are looking to overtake promises
Unlikely. Observables might be the better solution to certain problems, but that doesn't make promises obsolete (if that's what you mean).
本文探讨了Promise与ReactiveX Observable之间的区别。Promise用于解决单一异步操作,而Observable则适用于处理多个随时间推移发生的异步事件。文章还讨论了Observable是否将取代Promise的问题,并认为两者各有适用场景。
996

被折叠的 条评论
为什么被折叠?



