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)"

KajMagnus
  • 10,177
  • 14
  • 69
  • 115
  • 4
    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](http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts)... *Edit*: Ah, and that's because they're targeting ES7. So yeah, not for a *while*. – T.J. Crowder Jan 12 '14 at 09:25
  • There is a [shim](https://github.com/jdarling/Object.observe). – undefined Jan 12 '14 at 09:35

7 Answers7

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

thefourtheye
  • 206,604
  • 43
  • 412
  • 459
  • 4
    Interesting. So many things show up in Firefox first, rather than Chrome. This must be one spearheaded by the V8 members of the committee... – T.J. Crowder Jan 12 '14 at 09:28
  • Note the original link doesn't go the the right place anymore. Use http://kangax.github.io/compat-table/es7/ – ratiotile Jun 28 '14 at 20:59
  • 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. – Josh Nov 10 '14 at 11:53
  • @T.J.Crowder I think it's due to angular. – simonzack Mar 03 '15 at 20:34
  • Any ideas when we will see it in FF? – Nikos May 08 '15 at 20:46
  • @Nikos I could only find [this bug](https://bugzilla.mozilla.org/show_bug.cgi?id=800355) and unfortunately no one is working on it as of now :'( – thefourtheye May 08 '15 at 20:48
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.

Bart Verkoeijen
  • 12,647
  • 6
  • 48
  • 56
  • 6
    https://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 browser – Victor May 27 '14 at 08:59
  • @Victor 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`. – Bart Verkoeijen Jul 25 '14 at 02:39
4

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

basarat
  • 207,493
  • 46
  • 386
  • 462
3

Chrome 35+ supports Object.observe() Method.

More details here: html5rocks

Update: It's moved to chrome 36 beta.

Nitin Jadhav
  • 3,885
  • 35
  • 43
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

John Slegers
  • 38,420
  • 17
  • 182
  • 152
0

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

blockloop
  • 4,875
  • 4
  • 25
  • 29
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.

GullerYA
  • 719
  • 6
  • 20