Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gabemeola/nice-mutation-observer
Mutation Observer with a nicer api
https://github.com/gabemeola/nice-mutation-observer
Last synced: about 6 hours ago
JSON representation
Mutation Observer with a nicer api
- Host: GitHub
- URL: https://github.com/gabemeola/nice-mutation-observer
- Owner: gabemeola
- License: mit
- Created: 2019-04-16T15:53:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-06-26T07:24:18.000Z (over 2 years ago)
- Last Synced: 2024-01-01T21:10:50.217Z (11 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nice-mutation-observer
Mutation Observer with a nicer api## Usage
```js
// 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
```js
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();
```