您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

reducer.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // @flow
  2. import { PersistenceRegistry, ReducerRegistry } from '../base/redux';
  3. import { BACKGROUND_ENABLED, SET_VIRTUAL_BACKGROUND } from './actionTypes';
  4. const STORE_NAME = 'features/virtual-background';
  5. /**
  6. * Sets up the persistence of the feature {@code virtual-background}.
  7. */
  8. PersistenceRegistry.register(STORE_NAME, true);
  9. /**
  10. * Reduces redux actions which activate/deactivate virtual background image, or
  11. * indicate if the virtual image background is activated/deactivated. The
  12. * backgroundEffectEnabled flag indicate if virtual background effect is activated.
  13. *
  14. * @param {State} state - The current redux state.
  15. * @param {Action} action - The redux action to reduce.
  16. * @param {string} action.type - The type of the redux action to reduce..
  17. * @returns {State} The next redux state that is the result of reducing the
  18. * specified action.
  19. */
  20. ReducerRegistry.register(STORE_NAME, (state = {}, action) => {
  21. const { virtualSource, backgroundEffectEnabled, blurValue, backgroundType, selectedThumbnail } = action;
  22. switch (action.type) {
  23. case SET_VIRTUAL_BACKGROUND: {
  24. return {
  25. ...state,
  26. virtualSource,
  27. blurValue,
  28. backgroundType,
  29. selectedThumbnail
  30. };
  31. }
  32. case BACKGROUND_ENABLED: {
  33. return {
  34. ...state,
  35. backgroundEffectEnabled
  36. };
  37. }
  38. }
  39. return state;
  40. });