I am a bit confused, because Obejct.observe is said to be withdrawn from the ES2016.
On the other hand there were talks on Angular Connect that mentions they will rely on it.
So as far I understand Angular 2 doesn't rely on Object.observe directly but on RxJS which do use the Object.observe
Can you please help me understand the impacts of this withdrawal ? I am also confused how this will influence the functional reactive javascript development.
Sorry if it's stupid question, but all these concepts are really new to me.
RxJS introduces Observables, a new Push system for JavaScript. An Observable is a Producer of multiple values, "pushing" them to Observers (Consumers). A Function is a lazily evaluated computation that synchronously returns a single value on invocation.
Observable are just that — things you wish to observe and take action on. Angular uses the Observer pattern which simply means — Observable objects are registered, and other objects observe (in Angular using the subscribe method) them and take action when the observable object is acted on in some way.
An observable is a function that creates an observer and attaches it to the source where values are expected from, for example, clicks, mouse events from a dom element or an Http request, etc.
next() The subject next method is used to send messages to an observable which are then sent to all angular components that are subscribers (a.k.a. observers) of that observable.
RxJS doesn't rely on Object.observe (and afaik didn't intend to do so in the future) as RxJS doesn't have a concept of observable objects in itself (you could create objects with observable streams as values though).
For angular Object.observe would have been relevant, but it didn't rely on it yet I think (or at least not outside chrome).
Anyway, if you need observable objects, that is still possible by using the Mobservable library, as explained in this blogpost.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With