Reactively run a function, meaning the function will rerun when any Store that was read during its execution is updated. Calls to observe can be nested, such that changes to Stores read by the inner function do no cause the outer function to rerun.
Store
observe
let number = new Store(0)let doubled = new Store()setInterval(() => number.set(0|Math.random()*100)), 1000)observe(() => { doubled.set(number.get() * 2)})observe(() => { console.log(doubled.get())})
The function to be (repeatedly) executed.
Generated using TypeDoc
Reactively run a function, meaning the function will rerun when any
Store
that was read during its execution is updated. Calls toobserve
can be nested, such that changes toStore
s read by the inner function do no cause the outer function to rerun.Example