w: not printing all outputs?

This issue has been tracked since 2022-11-21.

Hey, awesome work! Excuse my ignorance, I am a newbie with frameworks, proxies etc..! I've got a couple of questions..

  1. 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..
  2. Since the watcher watches, why log immediately the function (for 25*10) since the data hasn't changed?
  3. 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}`);


data.price = 35
data.price = 66
data.price = 150
kyfex-uwu wrote this answer on 2022-11-22

For 2, generally you'd want a "starting state". In this case it would be helpful to know the total at the start of the script.

kyfex-uwu wrote this answer on 2022-11-22

And .$off is scheduled to be put in the documentation, see #13

justin-schroeder wrote this answer on 2022-11-22

Watchers in arrow will always run eagerly, otherwise they don’t know what their dependencies are. You can provide a second argument which is a second callback that receives the result of the watcher, and then you can choose to do something else with that value.

milkoqq wrote this answer on 2022-11-23

Thanks a lot! Will try out, I think I got it!

More Details About Repo
Owner Name justin-schroeder
Repo Name arrow-js
Full Name justin-schroeder/arrow-js
Language TypeScript
Created Date 2022-11-08
Updated Date 2023-03-28
Star Count 1240
Watcher Count 21
Fork Count 22
Issue Count 7


Issue Title Created Date Updated Date