Is there a good way to roughly achieve the following concept:
var computed = ko.computed(function() {
readSomeObservables(); //<-- if these change, notify computed
ko.stopCollectingDependencies();
readSomeMoreObservables(); //<-- if these change, do not notify computed
ko.resumeCollectingDependencies();
});
I am aware of peek()
, but in this case the computed is invoking methods that were provided from an external module, and the design calls for it to be purely incidental if those methods happen to involve observables.
I have one solution, which is to roughly do this:
window.setTimeout(function() {
readSomeMoreObservables();
}, 0);
But for obvious reasons, that is hardly ideal and leads to undesired behavior in some situations.