Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Object.observe withdrawal and RxJS and Angular 2

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.

like image 637
puffy Avatar asked Nov 10 '15 11:11

puffy


People also ask

What is observable and RxJS in Angular?

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.

What is observable and observer in Angular?

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.

What is observable from RxJS?

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.

What is .next in Angular?

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.


1 Answers

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.

like image 69
mweststrate Avatar answered Nov 16 '22 03:11

mweststrate