Which browsers support Object.observe?
Asked Answered
L

7

55

Which browsers, if any, support Object.observe? I'm surprised I'm unable to find any info on this.

(And are you aware about any estimated times of arrival for this feature?)

About Object.observe: "Object.observe allows for the direct observation of changes to ECMAScript objects. It allows an observer to receive a time-ordered sequence of change records which describe the set of changes which took place to the set of observed objects." — see ecmascript.org, the Solution section.)


Edit November 2015: Apparently Object.observe has been cancelled:

http://www.infoq.com/news/2015/11/object-observe-withdrawn

https://esdiscuss.org/topic/an-update-on-object-observe
"I plan to withdraw the Object.observe proposal from TC39"

https://esdiscuss.org/topic/save-object-observe-please-make-weakmap-weakset-observable
"Save Object.observe()! (please)"

Logistics answered 12/1, 2014 at 9:21 Comment(2)
I think it'll be a while before you see this broadly supported in the wild. It's not even in the latest draft specification... Edit: Ah, and that's because they're targeting ES7. So yeah, not for a while.Nodical
There is a shim.Scarito
R
4

No browsers. If its not true today, it will be true someday, and then this can be the accepted answer.

Radiometeorograph answered 15/1, 2016 at 4:25 Comment(1)
7 years later and I still wake up from time to time wishing for Object.observable.Klingensmith
K
31

You can use kangax's Browser Compatibility Table for Object.observe

It is part of ECMA Script 7 Specifications, it seems. Luckily, at the time of this writing, my current browser, Chrome 33, is the only one which supports it :)

If you like to enable it in Chrome 33,

  1. Visit chrome://flags/

  2. And enable Enable Experimental JavaScript

Kelson answered 12/1, 2014 at 9:24 Comment(6)
Interesting. So many things show up in Firefox first, rather than Chrome. This must be one spearheaded by the V8 members of the committee...Nodical
Note the original link doesn't go the the right place anymore. Use kangax.github.io/compat-table/es7Mete
The table by kangax shows it also only being available in Chrome 33-37 with the "Experimental Javascript features" flag. I have Chrome 38 and it's working without that flag enabled, so (assuming Kangax's table is correct) it was enabled by in Chrome 38.Monecious
@T.J.Crowder I think it's due to angular.Beckmann
Any ideas when we will see it in FF?Nedranedrah
@Nedranedrah I could only find this bug and unfortunately no one is working on it as of now :'(Kelson
Q
8

Polymer is a new and promising framework that intends to implement Web Components, for which Object.observe() is an integral part.

It provides polyfill implementation for "evergreen" browsers; the latest ones available. Moreover, they track what browser have native support for this feature, so it speeds up their implementation.

This polyfill is available as a separate library on GitHub.

Quito answered 18/3, 2014 at 15:8 Comment(2)
github.com/Polymer/observe-js - it is not a polyfill, rather a separate library which may use Object.observe if it is implemented in current browserOmidyar
@Omidyar to clarify; it provides a polyfill to observe changes to objects. The library will indeed fall back to (slow) dirty checking, instead of native Object.observe.Quito
R
4

No browsers. If its not true today, it will be true someday, and then this can be the accepted answer.

Radiometeorograph answered 15/1, 2016 at 4:25 Comment(1)
7 years later and I still wake up from time to time wishing for Object.observable.Klingensmith
D
3

Chrome 35+ supports Object.observe() Method.

More details here: html5rocks

Update: It's moved to chrome 36 beta.

Disjoint answered 21/5, 2014 at 17:10 Comment(5)
just got Chrome 35 but it doesn't seem to be available...even after enabling experimental js in the flags...weird?!Cruces
yep it's not in 35 but in 36 twitter.com/addyosmani/status/469145484901511168 a bit of confusion aroundCruces
It now seems that its in chrome 36 beta. Need to checkout though.Disjoint
chromestatus.com/features/6147094632988672 - marked as "Enabled by default" in Chrome 36Omidyar
Works by default on Chrome 36 (currently beta)Goldofpleasure
S
2

It used to be present in both Chrome & Opera, but the feature has been removed from both browsers after the standards committee withdrew the proposal for this feature!

enter image description here

Scorpaenid answered 14/7, 2017 at 23:39 Comment(0)
S
0

Chrome 36+, Opera 30+. My favorite way of answering these questions is http://caniuse.com. It's clear, consice, and has instant search.

Sabrina answered 23/7, 2015 at 4:28 Comment(0)
W
0

Disclaimer: I'm the author of object-observer library.

basarat's answer is definitelly the right one - nowadays no browser supports it.

Most of the polyfills performing 'dirty-checks' - not the best way to achieve observance IMHO.

Better way is to pick up one of the several libraries providing the same functionality utilizing native Proxy capabilities, object-observer being just one of them.

Wolf answered 12/2, 2017 at 20:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.