observer class:
constructor (value: any) {
this.value = value
this.dep = new Dep()
this.vmCount = 0
def(value, "__ob__", this)
if (Array.isArray(value)) {
const augment = hasProto
? protoAugment
: copyAugment
augment(value, arrayMethods, arrayKeys)
this.observeArray(value)
} else {
this.walk(value)
}
}
what is the purpose of the dep attribute here?
I know that the defineReactive method modifies the getter setter method to collect dependencies and notify watcher, but this method is operated by dep in the closure, so why declare an instance of dep in observer?
