11

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.

puffy
  • 225
  • 2
  • 9
  • 3
    `Object.observe` has absolutely nothing to do with [`Observables`](https://github.com/ReactiveX/RxJS), the names can be confusing, but they are not even related. – Eric Martinez Nov 10 '15 at 11:52
  • And you are not the only one who got confused, see this [issue](https://github.com/angular/angular/issues/5119), there you have the answer for a core team member. – Eric Martinez Nov 10 '15 at 12:11
  • I thought Angular 2 is using Object.observe with polyfill https://docs.google.com/document/d/10W46qDNO8Dl0Uye3QX0oUDPYAwaPl0qNy73TVLjd1WI/edit – fernando Nov 25 '15 at 04:06

2 Answers2

4

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.

mweststrate
  • 4,547
  • 1
  • 14
  • 22
0

FYI.... v4.1.0 does have some reliance on Object.observe when using Rx.Observable.ofObjectChanges(obj)...

Test it yourself in chrome which has now removed support for OO, if you use this method to create an observable you will get an OO error.

So whilst yes, OO has nothing to do with Observables in the context of RxJS, OO is used in 4.1.0 which is current stable and yet to be implemented in 5.X.X (which i would guess the delay is due to a switch to Proxy).

So if you want to use streams and the Rx pattern then no problem, if you want to use RxJS to observe an object, sorry, you will have to polyfill Proxy and use that as ofObjectChanges is broke ATM for chrome stable.

Paul
  • 1