private TvActionResult DoDispatchAction(TvAction action) { var newState = _currentState; var errored = TvActionResult.Failed(); var someError = false; foreach (var reducer in _reducers) { try { newState = reducer.Invoke(newState, action); } catch (Exception ex) { errored.AddError(ex); someError = true; } } var isDirty = _dirtyChecker(_currentState, newState); if (isDirty) { _subscribers.ForEach(x => x.Invoke(newState)); } _currentState = newState; return(someError ? errored : TvActionResult.OK); }
void ITvDispatcher.Dispatch(TvAction action) { foreach (var store in _stores.Values) { store.Dispatch(action); } }
public void Dispatch(TvAction action) { _pendingActions.Add(action); }