Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to observe multiple properties #1

Open
YohDeadfall opened this issue Aug 31, 2021 · 0 comments
Open

Ability to observe multiple properties #1

YohDeadfall opened this issue Aug 31, 2021 · 0 comments

Comments

@YohDeadfall
Copy link
Owner

There should be a method on the KineticObject to make a combined observable with a special property - in case of notification suspension it should trigger only one and not for each observed property.

API:

class KineticObject
{
    public IObservable<T1, T2> WhenAny(
        KineticReadOnlyProperty<T1> property1,
        KineticReadOnlyProperty<T2> property2);
    // etc.
}

Usage:

var obj = new KineticExample();
using (obj.SuppressChanges())
{
    obj.WhenAny(obj.Number, obj.Text)
        .Subscribe((n, t) => Assert.Equal(2, n));

    obj.Number.Set(2);
    obj.Text.Set("b");
}
// The assertion should pass

Problems:

  • As the example demonstrates, a reference to the object should be specified which makes the proposed API error prone. Therefore, it makes sense to support versioning, so any observable internally will have a reference to the source which already contains a version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant