public async Task <string> Dispatch(IAction action) { string msg = string.Empty; IActionReducer reducer = GetReducer(action); msg = await reducer.Reduce(action); return(msg); }
private IActionReducer GetReducer(IAction action) { IActionReducer retReducer = null; if (Reducers.Keys.Contains(action.Type)) { retReducer = Reducers[action.Type]; } return(retReducer); }
public RootReducerBuilder <TState> UseReducer(IActionReducer <TState> reducer) { _reducers.Add(reducer); return(this); }
public IObservable <TState> Scan <TState>(TState initialState, IActionReducer <TState> reducer) { return(_actions.Scan(initialState, reducer.Reduce)); }
public Store(IActionReducer <TState> rootReducer, IActionDispatcher dispatcher, TState initialState = default(TState)) { _dispatcher = dispatcher; _state = new BehaviorSubject <TState>(initialState); _dispatcher.Scan(initialState, rootReducer).Subscribe(s => _state.OnNext(s)); }