## 标准 API:attribute
绑定监听,监听 attribute 变化。回调函数的第一个参数为 MutationRecord[]。
> `attribute(target, callback[, subtree])`
- target
- 描述:需要被监听的节点
- 类型:`String`/`Element`/`Node`
- callback
- 描述:监听到变化时执行的回调函数
- 类型:`(mutations: MutationRecord[], observer: MutationObserver) => void`
- subtree
- 描述:是否将监视范围扩展至目标节点整个节点树中的所有节点
- 类型:`boolean`
- 默认值:`false`
## 变种 API:eattribute
绑定监听,监听 attribute 变化。回调函数的第一个参数为 MutationRecord。
> `eattribute(target, eachcall[, subtree])`
- target
- 描述:需要被监听的节点
- 类型:`String`/`Element`/`Node`
- eachcall
- 描述:监听到变化时执行的回调函数
- 类型:`(mutation: MutationRecord, observer: MutationObserver) => void`
- subtree
- 描述:是否将监视范围扩展至目标节点整个节点树中的所有节点
- 类型:`boolean`
- 默认值:`false`
## DEMO
```js
import { attribute, eattribute } from "m-observer"
attribute('#demo1' (mutations) => {
for (let mutation of mutaitons) {
// do something
}
}, true)
eattribute('#demo2', (mutation) => {
// do something
}, true)
```