Object.observe() is a proposed mechanism for bringing true data-binding to the browser. It exposes a mechanism for observing changes to objects and arrays, notifying others of mutations made to these objects.
Questions tagged [object.observe]
47 questions
1
vote
1 answer
Object.observe does not always gives me the right deleted index on an Array
I have a list with an observer function on it :
var names = ['joe', 'bob', 'loic'];
Object.observe(names, function(changes){
changes.forEach(function(change) {
console.log(change.type, change.name)
});
…
![](../../users/profiles/591922.webp)
Loic
- 3,079
- 4
- 22
- 38
1
vote
1 answer
Why does Object.observe() not provide the data path of change to a callback?
The changes array of an Object.observe() callback contains objects with the following four properties:
name
object
type
oldValue
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe#Parameters
Why isn't…
![](../../users/profiles/2044940.webp)
CodeManX
- 9,290
- 3
- 41
- 58
1
vote
0 answers
Model Change Detection: Object.observe Polyfill vs Angular Dirty Checking
Im wondering if anybody has done any benchmarking on polymer polyfill and angular dirty checking when it comes to model change detection.
Are these two performance checks 'apples to…
![](../../users/profiles/1707689.webp)
sesteva
- 1,506
- 2
- 14
- 17
1
vote
0 answers
How Object.observe() is different?
I understand that Angular uses dirty checking and Ember attach some watcher to the objects to detect changes. My question is how Object.observe() detect the change? How does it know when to trigger? Doesn't it also have some watcher like thing in…
![](../../users/profiles/2963895.webp)
Prasenjit Paul
- 61
- 9
1
vote
1 answer
Overwriting property in Object.observe()
I want to use Chrome's experimental Object.observe() in order to overwrite all functions being set on the object:
→ jsFiddle
var obj = {};
Object.observe(obj, function (changes) {
changes.forEach(function (data) {
if ((data.type ==…
![](../../users/profiles/603003.webp)
ComFreek
- 27,416
- 16
- 97
- 150
1
vote
1 answer
TypeError: Object function Object() { [native code] } has no method 'observe'
I recently came to know this function Object.observe() and tried implementing in my app.
var cs = {
name : "java",
version : "1.0"
}
cs.name = "javascript";
function doThis(){
console.log(cs.name);
}
Object.observe(cs, doThis);
But I…
![](../../users/profiles/771318.webp)
javaMan
- 5,562
- 17
- 57
- 86
0
votes
1 answer
Transitioning away from Object.observe
I've been using Object.observe() as part of a nw.js project that is now transitioning from nw.js v.0.12.3 to latest.
I have code like this:
..(myclass)..
data: { a:0, b:42 },
setupHandlers: function () {
Object.observe(this.data, changes =>…
![](../../users/profiles/75103.webp)
thebjorn
- 22,303
- 7
- 72
- 116
0
votes
1 answer
Using client javascript to monitor new elements added to document
i was using Object.observe() a few months ago to monitor any recursive changes from window.document. Now O.o() is withdrawn from em6+, i need to customize this behavior. I need access to new elements created anywhere in the document.
I've tried…
![](../../users/profiles/4379791.webp)
Null
- 123
- 7
0
votes
2 answers
Maximum stack exceeded when observing value of defined property
I am getting a Maximum call stack size exceeded error whenever I try to use Object.observe to observe changes in an object that I defined properties for through Object.defineProperty.
What is the correct way to get around throwing this error while…
![](../../users/profiles/691711.webp)
zero298
- 20,481
- 7
- 52
- 83
0
votes
1 answer
Polymer, observe global path, please
In Polymer 1.0 you can drop {{localPropFoo.bar}} and bar will be observed for changes if you use this.set('localPropFoo.bar', 'new value'); to update its value.
But what to do if you want to bind template to an external object which is out of your…
![](../../users/profiles/521957.webp)
ilyaigpetrov
- 3,149
- 3
- 25
- 42
0
votes
3 answers
How to detect change in a property of an object in an array with Polymer?
Let's say I want to create a todo list with Polymer (v0.5.5). In my element, I define a property tasks, which is an array containing a list of objects like { name: 'foo', done: false }. I want to display the number of remaining tasks, so I need to…
![](../../users/profiles/26457.webp)
Romain Linsolas
- 73,921
- 45
- 197
- 265
0
votes
1 answer
Object.observe order
I am using Object.observe() on node v0.11.13.
It looks like the time of the observation callback to be called can't be predicted. is it a bug or a feature?
Take a look at this code:
function observe(obj,name){
Object.observe(obj, function(o){
…
![](../../users/profiles/381211.webp)
DuduAlul
- 5,822
- 7
- 34
- 61
0
votes
2 answers
Object.observe() doesn't work native Image object
This doesn't work (in chrome 39 on OSX):
var x = new Image();
Object.observe(x, function(){console.log('i never run');})
x.src = 'http://www.foo.com';
console.log('has been set: ' + x.src);
But this will:
var x = new function…
![](../../users/profiles/1584651.webp)
Sam Adams
- 3,997
- 2
- 14
- 16
0
votes
1 answer
Why this Object.observe notify example does not work
I am trying to run the example posted here http://www.html5rocks.com/en/tutorials/es7/observe/ under notifications (using Thingy) to use Object.observe feature. Here is the code snippet I ran:
function Thingy(a, b, c) {
this.a = a;
this.b =…
![](../../users/profiles/568109.webp)
user568109
- 43,824
- 15
- 87
- 118
0
votes
2 answers
JavaScript Object Mirroring/One-way Property Syncing
For security purposes, I have a need for a "mirrored" object. i.e. if I create object A, and shallow-clone a copy of A and call it B, whenever a property of A changes, I hope to have B automatically update itself to reflect the changes, but not the…
![](../../users/profiles/707362.webp)
settinghead
- 95
- 1
- 6