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.

middleware.js 624B

12345678910111213141516171819202122232425
  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 which captures app startup and conference actions in order to
  8. * clear the image cache.
  9. *
  10. * @returns {Function}
  11. */
  12. MiddlewareRegistry.register(() => next => action => {
  13. switch (action.type) {
  14. case APP_WILL_MOUNT:
  15. case CONFERENCE_FAILED:
  16. case CONFERENCE_LEFT:
  17. ImageCache.get().clear();
  18. break;
  19. }
  20. return next(action);
  21. });