Skip to content

Instantly share code, notes, and snippets.

@jaredjburgess
Created March 30, 2016 14:09
Show Gist options
  • Save jaredjburgess/251b66a9c8d4f157ce93d912f14ee6cb to your computer and use it in GitHub Desktop.
Save jaredjburgess/251b66a9c8d4f157ce93d912f14ee6cb to your computer and use it in GitHub Desktop.
Function for mutation observers with callbacks.
function createMutationObserver(target, config, callback) {
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
callback(mutation);
});
});
observer.observe(target, config);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment