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

loadEffects.web.ts 978B

12345678910111213141516171819202122232425262728
  1. import { IStore } from '../../app/types';
  2. // eslint-disable-next-line lines-around-comment
  3. // @ts-ignore
  4. import { createVirtualBackgroundEffect } from '../../stream-effects/virtual-background';
  5. import logger from './logger';
  6. /**
  7. * Loads the enabled stream effects.
  8. *
  9. * @param {Object} store - The Redux store.
  10. * @returns {Promsie} - A Promise which resolves when all effects are created.
  11. */
  12. export default function loadEffects(store: IStore): Promise<any> {
  13. const state = store.getState();
  14. const virtualBackground = state['features/virtual-background'];
  15. const backgroundPromise = virtualBackground.backgroundEffectEnabled
  16. ? createVirtualBackgroundEffect(virtualBackground)
  17. .catch((error: Error) => {
  18. logger.error('Failed to obtain the background effect instance with error: ', error);
  19. return Promise.resolve();
  20. })
  21. : Promise.resolve();
  22. return Promise.all([ backgroundPromise ]);
  23. }