cleanupDeps () {
let i = this.deps.length
while (i--) {
const dep = this.deps[i]
if (!this.newDepIds.has(dep.id)) {
dep.removeSub(this)
}
}
let tmp = this.depIds
this.depIds = this.newDepIds
this.newDepIds = tmp
this.newDepIds.clear()
tmp = this.deps
this.deps = this.newDeps
this.newDeps = tmp
this.newDeps.length = 0
}
为什么前面遍历了this.deps,去除掉了不在
if (!this.newDepIds.has(dep.id)) {
dep.removeSub(this)
}
后面还要这样处理?
this.deps = this.newDeps