You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reducer.js 814B

12345678910111213141516171819202122232425262728293031323334
  1. import { ReducerRegistry } from '../base/redux';
  2. import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from './actionTypes';
  3. ReducerRegistry.register('features/app', (state = {}, action) => {
  4. switch (action.type) {
  5. case APP_WILL_MOUNT:
  6. if (state.app !== action.app) {
  7. return {
  8. ...state,
  9. /**
  10. * The one and only (i.e. singleton) App instance which is
  11. * currently mounted.
  12. *
  13. * @type {App}
  14. */
  15. app: action.app
  16. };
  17. }
  18. break;
  19. case APP_WILL_UNMOUNT:
  20. if (state.app === action.app) {
  21. return {
  22. ...state,
  23. app: undefined
  24. };
  25. }
  26. break;
  27. }
  28. return state;
  29. });