合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
## 标准 API:observeAll 绑定监听,监听所有变化。回调函数的第一个参数为 MutationRecord[]。 > `observeAll(target, callback[, filter])` - target - 描述:需要被监听的节点 - 类型:`string`/`Element`/`Node` - callback - 描述:监听到变化时执行的回调函数 - 类型:`(mutations: MutationRecord[], observer: MutationObserver) => void` - filter - 描述:`MutationObserverInit.attributeFilter` - 类型:`Array<string>` - 默认值:`undefined` ## 变种 API:eobserveAll 绑定监听,监听所有变化。回调函数的第一个参数为 MutationRecord。 > `eobserveAll(target, eachcall[, filter])` - target - 描述:需要被监听的节点 - 类型:`String`/`Element`/`Node` - eachcall - 描述:监听到变化时执行的回调函数 - 类型:`(mutation: MutationRecord, observer: MutationObserver) => void` - filter - 描述:`MutationObserverInit.attributeFilter` - 类型:`Array<string>` - 默认值:`undefined` ## DEMO ```js import { observeAll, eobserveAll } from "m-observer" observeAll('#demo1' (mutations) => { for (let mutation of mutaitons) { // do something } }) eobserveAll('#demo2', (mutation) => { // do something }, ['title', 'src', 'style', 'link', 'alt']) ```