Hey, awesome work! Excuse my ignorance, I am a newbie with frameworks, proxies etc..! I've got a couple of questions..
- Why doesn't the watcher log all the values in example below and just logs the first and the last one? I thought it would do something like $on/$off but with just a one-liner..
- Since the watcher watches, why log immediately the function (for 25*10) since the data hasn't changed?
- From the docs, I couldn't understand the use of $off in the example! Thanks!! Great work!
const data = r({
price: 25,
quantity: 10,
logTotal: true
})
function total () {
if (data.logTotal) {
console.log(`Total: ${data.price * data.quantity}`);
}
}
w(total)
data.price = 35
data.price = 66
data.price = 150