Sep 4, 2018 · 1 min read
What’s confusing here is that, when we call watcher(someMethod)` it just sets its reference to global target calls the method and clears it for next service/watcher.
1. The trick is target()` invokes get` of each value getting used inside (data.price, data.quantity here) and they automatically pick the global target variable.
2. we are keeping target as global as while accessing the data we cannot pass the target to each dependency/property we are using. so keeping the common target and clearing it afterward makes it easy for depend()` to find the subscriber function.