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

123456789101112131415161718192021222324252627282930313233
  1. // @flow
  2. import { ReducerRegistry } from '../../base/redux';
  3. import {
  4. _SET_APP_STATE_LISTENER,
  5. APP_STATE_CHANGED
  6. } from './actionTypes';
  7. /**
  8. * The default/initial redux state of the feature background.
  9. */
  10. const DEFAULT_STATE = {
  11. appState: 'active'
  12. };
  13. ReducerRegistry.register('features/background', (state = DEFAULT_STATE, action) => {
  14. switch (action.type) {
  15. case _SET_APP_STATE_LISTENER:
  16. return {
  17. ...state,
  18. appStateListener: action.listener
  19. };
  20. case APP_STATE_CHANGED:
  21. return {
  22. ...state,
  23. appState: action.appState
  24. };
  25. }
  26. return state;
  27. });