nice-mutation-observer
v1.0.1
Published
Mutation Observer with a nicer api
Downloads
3
Readme
nice-mutation-observer
Mutation Observer with a nicer api
Usage
// Install on Element prototype
import 'nice-mutation-observer/install';
const el = document.getElementById('app');
const config = { attributes: true, childList: true, characterData: true }
const disconnect = el.observe('childList', config, (mutation) => {
console.log('change!', mutation)
})
// Disconnect
disconnect();
Without global prototype
import observe from 'nice-mutation-observer';
const el = document.getElementById('app');
const config = { attributes: true, childList: true, characterData: true }
const disconnect = observe(el, 'childList', config, (mutation) => {
console.log('change!', mutation)
})
// Disconnect
disconnect();