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.

loadEffects.web.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435
  1. // @flow
  2. import { createScreenshotCaptureEffect } from '../../stream-effects/screenshot-capture';
  3. import { getBlurEffect } from '../../blur';
  4. import logger from './logger';
  5. /**
  6. * Loads the enabled stream effects.
  7. *
  8. * @param {Object} store - The Redux store.
  9. * @returns {Promsie} - A Promise which resolves when all effects are created.
  10. */
  11. export default function loadEffects(store: Object): Promise<any> {
  12. const state = store.getState();
  13. const blurPromise = state['features/blur'].blurEnabled
  14. ? getBlurEffect()
  15. .catch(error => {
  16. logger.error('Failed to obtain the blur effect instance with error: ', error);
  17. return Promise.resolve();
  18. })
  19. : Promise.resolve();
  20. const screenshotCapturePromise = state['features/screenshot-capture']?.capturesEnabled
  21. ? createScreenshotCaptureEffect(state)
  22. .catch(error => {
  23. logger.error('Failed to obtain the screenshot capture effect effect instance with error: ', error);
  24. return Promise.resolve();
  25. })
  26. : Promise.resolve();
  27. return Promise.all([ blurPromise, screenshotCapturePromise ]);
  28. }