123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import { ReducerRegistry } from '../base/redux';
-
- import {
- APP_WILL_MOUNT,
- APP_WILL_UNMOUNT,
- APP_SET_PLATFORM
- } from './actionTypes';
-
- ReducerRegistry.register('features/app', (state = {}, action) => {
- switch (action.type) {
- case APP_WILL_MOUNT:
- if (state.app !== action.app) {
- return {
- ...state,
-
- /**
- * The one and only (i.e. singleton) App instance which is
- * currently mounted.
- *
- * @type {App}
- */
- app: action.app
- };
- }
- break;
-
- case APP_WILL_UNMOUNT:
- if (state.app === action.app) {
- return {
- ...state,
- app: undefined
- };
- }
- break;
-
- case APP_SET_PLATFORM:
- return {
- ...state,
- platform: action.platform
- };
-
- }
-
- return state;
- });
|