Пример #1
0
        public void Dispatch(TAction action)
        {
            lock (_syncRoot)
            {
                State = _rootReducer(State, action);
                _devToolsInterop.Log(action.ToString(), _options.StateSerializer(State));
                History.Add(new HistoricEntry <TState, object>(State, action));
            }

            OnChange(null);
        }
Пример #2
0
        public Store(TState initialState, Reducer <TState, TAction> rootReducer, ReduxOptions <TState> options, DevToolsInterop devToolsInterop)
        {
            _initialState    = initialState;
            _rootReducer     = rootReducer;
            _options         = options;
            _devToolsInterop = devToolsInterop;

            State = initialState;

            _devToolsInterop.Reset      += OnDevToolsReset;
            _devToolsInterop.TimeTravel += OnDevToolsTimeTravel;
            _devToolsInterop.Log("initial", _options.StateSerializer(State));

            History = new List <HistoricEntry <TState, object> >
            {
                new HistoricEntry <TState, object>(State)
            };
        }