示例#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, IJSRuntime jsRuntime)
        {
            _initialState = initialState;
            _rootReducer  = rootReducer;
            _options      = options;

            State = initialState;
            DevToolsInterop.JSRuntime   = jsRuntime;
            DevToolsInterop.Reset      += OnDevToolsReset;
            DevToolsInterop.TimeTravel += OnDevToolsTimeTravel;
            DevToolsInterop.Log("initial", _options.StateSerializer(State));

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