public void SetUp() { var store = new TestStore(); Flux.StoreResolver.Register(store); _view = new TestView(); }
public static void Dispatch <TView, TPayload>(this IFluxViewFor <TView> view, TPayload payload) where TView : Store { var appDispatcher = Locator.Current.GetService <Dispatcher>(); if (appDispatcher == null) { // TODO: we should fail the app return; } appDispatcher.Dispatch(payload); }
public static void Dispatch <TStore, TPayload>(this IFluxViewFor <TStore> view, TPayload payload) where TStore : Store { var dispatcher = Flux.Dispatcher; if (dispatcher == null) { throw new NullDispatcherException(); } dispatcher.Dispatch(payload); }
public static void OnChange <T>(this IFluxViewFor <T> view, Action <T> callback) where T : Store { var dispatcher = Flux.Dispatcher; if (dispatcher == null) { throw new NullDispatcherException(); } var store = new Lazy <T>(GetStore <T>); dispatcher.Register <ChangePayload>(payload => callback(store.Value)); EmitChange(view); }
public static void OnChange <T>(this IFluxViewFor <T> view, Action <T> callback) where T : Store { var appDispatcher = Locator.Current.GetService <Dispatcher>(); if (appDispatcher == null) { // TODO: we should fail the app return; } var lazyStore = new Lazy <T>(() => Locator.Current.GetService <T>()); appDispatcher.Register <ChangePayload>(payload => callback(lazyStore.Value)); // lol hiding the hax away view.EmitChange(); }
public static void EmitChange <TView>(this IFluxViewFor <TView> view) where TView : Store { view.Dispatch(new ChangePayload()); }
public void TearDown() { _view = null; }
public static void EmitChange <T>(this IFluxViewFor <T> view) where T : Store { Dispatch(view, new ChangePayload()); }