-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Explore explicit invalidation idea #21
Comments
The easiest solution would be to have a var mutableObject = new MutableObject();
var state = Observable.State(mutableObject, NeverEqualityComparer<MutableObject>.Instance);
void Mutate(string newValue)
{
mutableObject.Field = newValue;
state.ForceInvalidate();
} Gotta medidate on this some more to figure out whether it's a good enough API or we need some extra complications. |
Hmm, alternatively we could have a separate API, like |
The original tink_state equivalent for this would actually be the |
One more API idea that, I think, is pretty in spirit of .NET is to have a "source" interface with mutation methods that exposes itself as the read-only observable. Kinda similar to how it works with CancellationTokens and tasks. E.g. something like this (already works in my quick prototype). public interface ManualObservableSource<T>
{
Observable<T> Observe();
void Invalidate();
void Update(T newValue);
} |
It might be useful to have a
State
of a mutable object (like a ZString) with a possibility to explicitly invalidate and notify all bindings/auto-observables without changing theValue
itself.This would be similar to how
ObservableList/ObservableDictionary
work.Gotta play with the idea and think of the best way to make it play nice with comparators.
The text was updated successfully, but these errors were encountered: