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

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