public static void TrackModel(this IReactiveElement parentModel, IReactiveElement subModel) { if (parentModel is null) { throw new ArgumentNullException(nameof(parentModel)); } if (subModel is null) { throw new ArgumentNullException(nameof(subModel)); } // Propagate ViewModel state changes to Component StateChanges parentModel.Effect(subModel.StateChanged, parentModel.StateChanged.Call); }
public static TReactive CreateReactive <T, TReactive>( this IReactiveElement self, IObservable <T> valueStream, Func <IObservable <T>, TReactive> factory) where TReactive : class, IUpdatableElement, IDisposable { if (self is null) { throw new ArgumentNullException(nameof(self)); } if (valueStream is null) { throw new ArgumentNullException(nameof(valueStream)); } var reactive = factory(valueStream); self.Effect(reactive.ValueChanged, self.StateChanged.Call); return(self.DeferDispose(reactive)); }
public static IDisposable Effect(this IReactiveElement self, Command command) => self.Effect(command.Stream);
public static IDisposable Effect <T>(this IReactiveElement self, Command <T> command, Action <T> reaction) => self.Effect(command.Stream, reaction);
public static IDisposable Effect <T>(this IReactiveElement self, Property <T> property, Action <T> reaction) => self.Effect(property.Stream, reaction);
public static IDisposable Effect(this IReactiveElement self, IObservable <Unit> stream) => self.Effect(stream, _ => { });