Looking at the new observe ES6 featues inside object, I was wondering whether Ember and ES6 are equivalent or different? Can we use the Watchjs polyfill safely with ember?

- 630,263
- 148
- 957
- 1,375

- 829
- 9
- 23
-
1Nit: Object.observe is _not_ in ES6. – Andreas Rossberg Nov 25 '12 at 09:33
-
@Niit do check this out http://addyosmani.com/blog/a-few-new-things-coming-to-javascript/ – Ankur Agarwal Nov 25 '12 at 10:50
-
1The blog might be misleading. Object.observe has recently been given "proposal" status for _ES7_, not ES6. – Andreas Rossberg Nov 25 '12 at 14:38
1 Answers
Looking at the new observe ES6 featues inside object, I was wondering whether Ember and ES6 are equivalent or different?
Most definitely different. EmberJs has it own system, where every "model" (object whose properties may be observed), is wrapped in an instance of Ember.Object
.
The Ember.Object
base class provides all the mechanisms for listening for property changes.
In order to use them, all one needs to do is .get()
and .set()
to access and mutate its properties.
Can we use the Watchjs polyfill safely with ember?
I have not tried this before, but I would caution against it, as my educated guess is that it will not work. This is because, as mentioned above, Ember relies on get
ters and set
ters to listen for changes on object properties, not Object.observe
. So even if you use this WatchJs (or any other polyfill), EmberJs app would be oblivious to the changes, because Ember.Object
does not understand or use this at the moment.

- 888
- 1
- 8
- 14