Created
November 13, 2013 16:47
-
-
Save thomasboyt/7452265 to your computer and use it in GitHub Desktop.
recursive object.observe sadness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://vimeo.com/96425312
The video above should explain why :) if you still wondering why this is.