Skip to content

Instantly share code, notes, and snippets.

@serverwentdown
Last active August 29, 2015 14:10
Show Gist options
  • Save serverwentdown/5b6f804cef53118db28b to your computer and use it in GitHub Desktop.
Save serverwentdown/5b6f804cef53118db28b to your computer and use it in GitHub Desktop.
Object.observe() all child elements too.
function observeTree(object, cb) {
Object.observe(object, function (changes) {
if ((changes[0].type == "add" || changes[0].type == "update") && typeof changes[0].object[changes[0].name] == "object") {
observeTree(changes[0].object[changes[0].name], cb);
}
cb(changes);
});
}
@serverwentdown
Copy link
Author

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                    Version 2, December 2004

 Copyright (C) 2004 Sam Hocevar <[email protected]>

 Everyone is permitted to copy and distribute verbatim or modified
 copies of this license document, and changing it is allowed as long
 as the name is changed.

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. You just DO WHAT THE FUCK YOU WANT TO.

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