Skip to content

Instantly share code, notes, and snippets.

@vldvel
Created March 22, 2018 07:53
Show Gist options
  • Save vldvel/5a56eb5c423fcd9e0c26c532b642306d to your computer and use it in GitHub Desktop.
Save vldvel/5a56eb5c423fcd9e0c26c532b642306d to your computer and use it in GitHub Desktop.
MutationObserver constructor
// create subscriber
function subscriber (mutations) {
mutations.forEach((mutation) => {
console.log(mutation);
});
}
// create observer
const observer = new MutationObserver(subscriber);
// observer methods
for (const prop in observer.__proto__) {
console.log(prop); // observe, disconnect, takeRecords
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment