Пример #1
0
        /// <summary>
        /// Dispatches an action to the Store.
        /// </summary>
        /// <param name="action">Action to be dispatched.</param>
        public void Dispatch(ReduxAction action)
        {
            // Action must not be null.
            if (action == null)
            {
                throw new ArgumentNullException("action", Properties.Resources.DISPATCH_ACTION_NULL_ERROR);
            }

            IState currentState = GetState();

            InvokeDispatcher(action);
            IState nextState = GetState();

            // Emit a StateChange event only if the state has changed.
            if (!EqualityComparer <IState> .Default.Equals(currentState, nextState))
            {
                OnStateChange(nextState);
            }
        }
Пример #2
0
 private void InvokeDispatcher(ReduxAction action)
 {
     Dispatcher(action);
 }