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

middleware.native.js 678B

123456789101112131415161718192021222324
  1. import { MEDIA_TYPE, setVideoMuted, VIDEO_MUTISM_AUTHORITY } from '../base/media';
  2. import { MiddlewareRegistry } from '../base/redux';
  3. import { SET_CAR_MODE } from './actionTypes';
  4. import './middleware.any';
  5. /**
  6. * Middleware which intercepts actions and updates the legacy component.
  7. *
  8. * @param {Store} store - The redux store.
  9. * @returns {Function}
  10. */
  11. MiddlewareRegistry.register(store => next => action => {
  12. const result = next(action);
  13. const { dispatch } = store;
  14. switch (action.type) {
  15. case SET_CAR_MODE:
  16. dispatch(setVideoMuted(action.enabled, MEDIA_TYPE.VIDEO, VIDEO_MUTISM_AUTHORITY.CAR_MODE));
  17. break;
  18. }
  19. return result;
  20. });