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 836B

12345678910111213141516171819202122232425262728293031323334353637
  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. const { app } = action;
  7. if (state.app !== app) {
  8. return {
  9. ...state,
  10. /**
  11. * The one and only (i.e. singleton) App instance which is
  12. * currently mounted.
  13. *
  14. * @type {App}
  15. */
  16. app
  17. };
  18. }
  19. break;
  20. }
  21. case APP_WILL_UNMOUNT:
  22. if (state.app === action.app) {
  23. return {
  24. ...state,
  25. app: undefined
  26. };
  27. }
  28. break;
  29. }
  30. return state;
  31. });