Skip to content

Instantly share code, notes, and snippets.

@thomasboyt
Created November 13, 2013 16:47
Show Gist options
  • Save thomasboyt/7452265 to your computer and use it in GitHub Desktop.
Save thomasboyt/7452265 to your computer and use it in GitHub Desktop.
recursive object.observe sadness
var foo = {};
function createObserve(obj) {
Object.observe(obj, function(changeset) {
changeset.forEach(function(change) {
if (typeof change.object[change.name] === "object") {
createObserve(change.object[change.name]);
}
console.log(change.name);
});
});
}
createObserve(foo);
foo.a = {};
foo.a.b = "you'll never see this";
setTimeout(function() {
foo.a.c = "but you will see this";
}, 0);
@valtido
Copy link

valtido commented Oct 24, 2014

http://vimeo.com/96425312

The video above should explain why :) if you still wondering why this is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment