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 730B

123456789101112131415161718192021222324252627282930
  1. // @flow
  2. import UIEvents from '../../../service/UI/UIEvents';
  3. import { MiddlewareRegistry } from '../base/redux';
  4. import { TOGGLE_SHARED_VIDEO } from './actionTypes';
  5. declare var APP: Object;
  6. /**
  7. * Middleware that captures actions related to YouTube video sharing and updates
  8. * components not hooked into redux.
  9. *
  10. * @param {Store} store - The redux store.
  11. * @returns {Function}
  12. */
  13. // eslint-disable-next-line no-unused-vars
  14. MiddlewareRegistry.register(store => next => action => {
  15. if (typeof APP === 'undefined') {
  16. return next(action);
  17. }
  18. switch (action.type) {
  19. case TOGGLE_SHARED_VIDEO:
  20. APP.UI.emitEvent(UIEvents.SHARED_VIDEO_CLICKED);
  21. break;
  22. }
  23. return next(action);
  24. });