Skip to content

Instantly share code, notes, and snippets.

@d4tocchini
Last active December 25, 2015 13:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d4tocchini/6982098 to your computer and use it in GitHub Desktop.
Save d4tocchini/6982098 to your computer and use it in GitHub Desktop.
handleMutations: (mutations) =>
for m in mutations
for node in m.removedNodes
doSomethingToRemoved node
for node in m.addedNodes
doSomethingToAdded node
if m.type is "characterData" or m.type is "attributes" or m.type is "childList"
doSomethingWithType(m)
observer = new MutationObserver handleMutations
observer.observe(document.getElementById('graph'), {subtree: true, childList: true, attributes: false, characterData: false})
#observer.disconnect()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment