Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Issue 162553 v8 support for Object.observe()
Starred by 23 users Project Member Reported by meh@chromium.org, Nov 25 2012 Back to list
Status: Fixed
Owner:
Email to this user bounced
Closed: Jan 2015
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Launch-OWP
Launch-Accessibility: ----
Launch-Legal: ----
Launch-M-Approved: ----
Launch-M-Target: ----
Launch-Privacy: ----
Launch-Security: ----
Launch-Status: ----
Launch-Test: ----
Launch-UI: ----



Sign in to add a comment
It's now landed in Canary (behind Experimental JS APIs).

(See http://goto.google.com/owp-launch-guide for an overview)

*High-level description of the change (1-2 sentences):*
Provides a runtime capability to observe changes to an object.

UI frameworks often want to provide an ability to databind objects in a datamodel to UI elements. A key component of databinding is to track changes to the object being bound. Today, JavaScript framework which provide databinding typically create objects wrapping the real data, or require objects being databound to be modified to buy in to databinding. The first case leads to increased working set and more complex user model, and the second leads to siloing of databinding frameworks. With Object.observe(), neither workaround is needed.

*Listing of additions/modifications/changes to API surface (bullet
points):*

Example of how this works:

var o = {};

Object.observe(o, function(changes) {
  changes.forEach(function(change, i) {
    console.log(change.name, change.type, change.object[change.name]);
  });
});

// 3 changes, as a list of changes. Similar to how Mutation Observers work.
o.first = 'Eric';
o.last = 'Bidelman';
delete o.first;

---------
Additional context (fill in as much as you can, or link to a prior API
launch bug with the context):
*Link to relevant webkit or crbug:*
v8 bug: https://code.google.com/p/v8/issues/detail?id=2409
write up: http://weblog.bocoup.com/javascript-object-observe/

*Link to relevant public standards discussion:*
http://wiki.ecmascript.org/doku.php?id=harmony:observe

*Support in other browsers (current and expected):*
Internet Explorer:
Firefox
Safari:
Opera:

Make sure to fill in any labels with a -?. Feel free to leave other labels
at the defaults.

 
Comment 1 by meh@chromium.org, Nov 29 2012
Labels: -Mstone-25 Mstone-X
We won't mention this in the Chromium blog post for web developers until it's landed without a flag, so I'm moving to Mstone-X for now. 

Once it lands without a flag we can update the milestone.
Project Member Comment 2 by bugdroid1@chromium.org, Mar 9 2013
Labels: -OWP-DesignReview-No OWP-Design-No
Cc: gregsimon@chromium.org
Comment 4 by meh@google.com, Jun 18 2013
AFAIK Object.observe is currently available behind a runtime flag in Stable.  What's the timeline for shipping enabled-by-default?
There is currently no target Mstone for shipping, which is gated on (at very least) TC-39 reviewing final spec language.
Labels: Cr-Blink-JavaScript
Comment 7 by adamk@chromium.org, Mar 14 2014
Cc: rossberg@chromium.org danno@chromium.org
Labels: -Mstone-X M-35
Owner: rafaelw@chromium.org
This was turned on in v8 trunk in https://code.google.com/p/v8/source/detail?r=19870 and rolled into chromium in https://src.chromium.org/viewvc/chrome?view=revision&revision=256797
Current implementation of Object.observe() doesn't seem to work with DOM objects, e.g. manual changes to the "id" property of HTMLDivElement instance are not reported.
I didn't think that O.o would ever support observation for DOM elements. I thought it was only for non-DOM objects. 
Re #9: Object.observe() already works with custom elements created with document.registerElement(), so I would expect it to work with standard elements as well.

I believe this is a very important feature because when you use Web Components, the majority of objects that you would want to observe are DOM objects.
Isn't this done?
Comment 12 by adamk@chromium.org, Jan 29 2015
Status: Fixed
Yes, this has been in in Chrome since M36. Further bugs should be tracked in V8's bug tracker at code.google.com/p/v8/issues
What is the reason behind removing this feature?

https://www.chromestatus.com/features/6147094632988672
Yes, why is this being removed?
It was withdrawn from the standard:https://esdiscuss.org/topic/an-update-on-object-observe
Will there be some sort of a way to keep this included in apps? A polyfill or something?
@16 I don't think it's possible to write a proper polyfill for Object.observe(), but the new Proxy API should allow you to create an observable version of any arbitrary object.
Project Member Comment 18 by bugdroid1@chromium.org, Jul 13 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6bc726f327493247a01876b2d19dc960ce15e805

commit 6bc726f327493247a01876b2d19dc960ce15e805
Author: rbyers <rbyers@chromium.org>
Date: Wed Jul 13 03:07:35 2016

Remove Object.observe UseCounter and deprecation warning

Object.observe is long gone, remove the unreachable counter to avoid
confusion (since it references a long-gone milestone).

BUG= 162553 

Review-Url: https://codereview.chromium.org/2126593002
Cr-Commit-Position: refs/heads/master@{#404942}

[modify] https://crrev.com/6bc726f327493247a01876b2d19dc960ce15e805/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
[modify] https://crrev.com/6bc726f327493247a01876b2d19dc960ce15e805/third_party/WebKit/Source/core/frame/Deprecation.cpp
[modify] https://crrev.com/6bc726f327493247a01876b2d19dc960ce15e805/third_party/WebKit/Source/core/frame/UseCounter.h

Project Member Comment 19 by bugdroid1@chromium.org, Jul 13 2016
Labels: merge-merged-2795
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6bc726f327493247a01876b2d19dc960ce15e805

commit 6bc726f327493247a01876b2d19dc960ce15e805
Author: rbyers <rbyers@chromium.org>
Date: Wed Jul 13 03:07:35 2016

Remove Object.observe UseCounter and deprecation warning

Object.observe is long gone, remove the unreachable counter to avoid
confusion (since it references a long-gone milestone).

BUG= 162553 

Review-Url: https://codereview.chromium.org/2126593002
Cr-Commit-Position: refs/heads/master@{#404942}

[modify] https://crrev.com/6bc726f327493247a01876b2d19dc960ce15e805/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
[modify] https://crrev.com/6bc726f327493247a01876b2d19dc960ce15e805/third_party/WebKit/Source/core/frame/Deprecation.cpp
[modify] https://crrev.com/6bc726f327493247a01876b2d19dc960ce15e805/third_party/WebKit/Source/core/frame/UseCounter.h

Sign in to add a comment