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

middleware.native.ts 738B

1234567891011121314151617181920212223242526272829
  1. import MiddlewareRegistry from '../redux/MiddlewareRegistry';
  2. import { CLIENT_RESIZED } from './actionTypes';
  3. import { setAspectRatio, setReducedUI } from './actions';
  4. /**
  5. * Middleware that handles window dimension changes and updates the aspect ratio and
  6. * reduced UI modes accordingly.
  7. *
  8. * @param {Store} store - The redux store.
  9. * @returns {Function}
  10. */
  11. MiddlewareRegistry.register(({ dispatch }) => next => action => {
  12. const result = next(action);
  13. switch (action.type) {
  14. case CLIENT_RESIZED: {
  15. const { clientWidth: width, clientHeight: height } = action;
  16. dispatch(setAspectRatio(width, height));
  17. dispatch(setReducedUI(width, height));
  18. break;
  19. }
  20. }
  21. return result;
  22. });