Last active
January 8, 2017 13:34
-
-
Save vincentorback/cdb28678d5a1f67e4860622f282c9127 to your computer and use it in GitHub Desktop.
Listen to modifications to the DOM
This file contains hidden or 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
const observer = new MutationObserver(function (mutations) { | |
// Do the things | |
}); | |
let targetEl = document.documentElement; // Can be any element | |
observer.observe(targetEl, { | |
childList: true, | |
subtree: true, | |
attributes: true, | |
characterData: true | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment