Which browsers support Object.observe?

2019-01-31 02:33发布

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

7条回答
Lonely孤独者°
2楼-- · 2019-01-31 02:58

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.

查看更多
混吃等死
3楼-- · 2019-01-31 03:03

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

查看更多
放荡不羁爱自由
4楼-- · 2019-01-31 03:07

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

查看更多
成全新的幸福
5楼-- · 2019-01-31 03:08

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

查看更多
我欲成王,谁敢阻挡
6楼-- · 2019-01-31 03:14

Chrome 35+ supports Object.observe() Method.

More details here: html5rocks

Update: It's moved to chrome 36 beta.

查看更多
仙女界的扛把子
7楼-- · 2019-01-31 03:18

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.

查看更多
登录 后发表回答