angular - Is there any difference in overhead when using Observables as opposed to promises? -
i considering whether use observables or promises in new angular 2 app. told observables can promises can , more, curious how overhead observables require compared promises. has run benchmark tests? there reasons left use promises?
whereas both observables , promises deal asynchronous processing, there differences:
- observables can canceled. promises can't.
- observables lazy , executed when callbacks subscribed them. promises executed when created.
- observables can handle several events whereas promises can resolved once.
- observables provide set of operators create asynchronous data flow (like
map
,flatmap
,filter
, ...)
Comments
Post a Comment