Exemple #1
0
        public Store(TState initialState, Func <TState, TEvent, TState> reducer)
        {
            var initialStateTransition = StateTransition.NewInitial(initialState);

            StateTransitions =
                Events
                .Scan(initialStateTransition, StateTransition.LiftReducer(reducer))
                .StartWith(initialStateTransition)
                .Publish()
                .AutoConnect();

            States =
                StateTransitions
                .Select(StateTransition.StateOf)
                .DistinctUntilChanged()
                .Replay(1)
                .AutoConnect(0);
        }