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

middleware.js 718B

12345678910111213141516171819202122232425262728
  1. /* @flow */
  2. import { ImageCache } from 'react-native-img-cache';
  3. import { APP_WILL_MOUNT } from '../../app';
  4. import { CONFERENCE_FAILED, CONFERENCE_LEFT } from '../../base/conference';
  5. import { MiddlewareRegistry } from '../../base/redux';
  6. /**
  7. * Middleware that captures conference actions and application startup in order
  8. * cleans up the image cache.
  9. *
  10. * @param {Store} store - Redux store.
  11. * @returns {Function}
  12. */
  13. // eslint-disable-next-line no-unused-vars
  14. MiddlewareRegistry.register(store => next => action => {
  15. switch (action.type) {
  16. case APP_WILL_MOUNT:
  17. case CONFERENCE_FAILED:
  18. case CONFERENCE_LEFT:
  19. ImageCache.get().clear();
  20. break;
  21. }
  22. return next(action);
  23. });