Created
December 18, 2020 17:02
-
-
Save bfolkens/c1e69f7cc67ec6d8b3dafe42f4e93a1e to your computer and use it in GitHub Desktop.
Javascript MutationObserver example
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
// Test for now - eventually use this to continue | |
const mutationObserver = new MutationObserver(mutations => { | |
mutations.forEach(mutation => { | |
console.debug(mutation) | |
}) | |
}) | |
mutationObserver.observe(elementToWatch, { | |
attributes: true, | |
characterData: true, | |
childList: true, | |
subtree: true, | |
attributeOldValue: true, | |
characterDataOldValue: true | |
}) | |
... do some stuff | |
mutationObserver.disconnect() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment