Content deleted Content added
←Created page with 'An observable is one of the key components of reactive programming and was a proposed standard for managing asynchronous data in ECMAScript 2017. An obse...' |
No edit summary |
||
Line 1:
An observable is one of the key components of [[reactive programming]] and was a proposed standard for managing asynchronous data in [[ECMAScript
==Composition with Reactive Operators==
The real power of observables comes from the array like operations
The reactive operators allow to compose asynchronous sequences together in a declarative manner with all the efficiency benefits of callbacks but without the drawbacks of nesting callback handlers that are typically associated with asynchronous systems.
==Observables in Angular==
[[Angular]] makes extensive use of observables through RxJs library for various common asynchronous tasks, listed below are few examples<ref>https://angular.io/guide/observables-in-angular</ref>:
* The EventEmitter class extends observable.
* The HTTP module uses observables to handle AJAX calls.
* The Router module provides events in the navigation process as observables.
* Reactive Forms module uses observables to monitor form control values.
==Comparison with Promises==
Observables are often compared to promises as both these techniques are primarily used for handling asynchronous tasks, however below are the key differences<ref>https://angular.io/guide/comparing-observables</ref>:
*In observables computation does not start until subscription, Promises execute immediately on creation.
*Observables provide multiple values over time, Promises provide only one.
*Observables differentiate between chaining and subscription. Promises only have .then() clauses.
== See also ==
{{Portal|Computer programming}}
* [[Reactive programming]]
* [[Reactive extensions]]
==Notes==
{{Reflist|group=note}}
==References==
{{Reflist|colwidth=30em}}
[[Category:Programming language concepts]]
[[Category:Data types]]
|