Skip to content

Instantly share code, notes, and snippets.

@superMDguy
Last active September 25, 2017 20:35
Show Gist options
  • Save superMDguy/5d79cf4cc234eb4e78df76ea4af7fc64 to your computer and use it in GitHub Desktop.
Save superMDguy/5d79cf4cc234eb4e78df76ea4af7fc64 to your computer and use it in GitHub Desktop.
// the current target watcher being evaluated.
// this is globally unique because there could be only one
// watcher being evaluated at any time.
Dep.target = null
const targetStack = []
function pushTarget(_target) {
if (Dep.target) targetStack.push(Dep.target)
Dep.target = _target
}
function popTarget() {
Dep.target = targetStack.pop()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment