Last active
December 25, 2015 13:09
-
-
Save d4tocchini/6982098 to your computer and use it in GitHub Desktop.
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
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