Skip to content

react to changes of specific observables within computed #22

@mbest

Description

@mbest

The pattern is to have a computed observable in which sections could be set up to run only when specific observables change. Example:

var A = ko.computed(function(didChange) {
    var c = 0;
    if (didChange(a)) {    // `a` is an observable
        // do something when `a` has changed
        c = a() + 1;
    }
    // also do something with other observables such as `b`
    return b() + c;
});

Something like this would provide another way to deal with setting up independent bindings. And it's something that's been asked about in the forums.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions