Object.observe withdrawal and RxJS and Angular 2
Asked Answered
K

2

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.

Keeler answered 10/11, 2015 at 11:48 Comment(3)
Object.observe has absolutely nothing to do with Observables, the names can be confusing, but they are not even related.Verbenia
And you are not the only one who got confused, see this issue, there you have the answer for a core team member.Verbenia
I thought Angular 2 is using Object.observe with polyfill docs.google.com/document/d/…Deenadeenya
G
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.

Gaultheria answered 11/11, 2015 at 21:0 Comment(0)
A
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.

Along answered 9/11, 2016 at 10:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.