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

Popular posts from this blog

Combining PHP Registration and Login into one class with multiple functions in one PHP file -

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -