Hello, and thank you for making this. I've dumped a fairly complicated setup using Knockout for this one simple library.
I have run into a problem with computed values though. I actually like the comp | watch foo bar formatter, since it makes the dependencies explicit. (I've had problems in the past with Knockout's "magic" computed resolution) That said there are also use cases where more abstraction would be nice.
For example I am currently working on a page with the sole purpose of building a URL with complicated query parameters. I would like to have an automatically updating preview of the computed URL, but the computed function will depend on virtually every field in every model/submodel.
One simple solution would be a way to specify that the computed watches an entire object (e.g. comp | watch $root). You could then just pre-compute a list of all sub fields to be watched.
Another option from RIvets per mikeric/rivets#270 is to move the dependency declaration from the html template to the model definition/binding.
As things are now I'm trying to push some dependent calculations down to sub models, and expose some plain fields to signal updates up the chain. This requires that I trigger sub-graph computation through the dom though...
Hello, and thank you for making this. I've dumped a fairly complicated setup using Knockout for this one simple library.
I have run into a problem with computed values though. I actually like the
comp | watch foo bar
formatter, since it makes the dependencies explicit. (I've had problems in the past with Knockout's "magic" computed resolution) That said there are also use cases where more abstraction would be nice.For example I am currently working on a page with the sole purpose of building a URL with complicated query parameters. I would like to have an automatically updating preview of the computed URL, but the computed function will depend on virtually every field in every model/submodel.
One simple solution would be a way to specify that the computed watches an entire object (e.g.
comp | watch $root
). You could then just pre-compute a list of all sub fields to be watched.Another option from RIvets per mikeric/rivets#270 is to move the dependency declaration from the html template to the model definition/binding.
As things are now I'm trying to push some dependent calculations down to sub models, and expose some plain fields to signal updates up the chain. This requires that I trigger sub-graph computation through the dom though...