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.

actions.web.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import {
  2. LIB_DISPOSED,
  3. SET_CONFIG
  4. } from './actionTypes';
  5. import './middleware';
  6. import './reducer';
  7. /**
  8. * Disposes lib-jitsi-meet.
  9. *
  10. * @returns {Function}
  11. */
  12. export function disposeLib() {
  13. // XXX We're wrapping it with Promise, because:
  14. // a) to be better aligned with initLib() method, which is async.
  15. // b) as currently there is no implementation for it in lib-jitsi-meet, and
  16. // there is a big chance it will be async.
  17. // TODO Currently, lib-jitsi-meet doesn't have any functionality to
  18. // dispose itself.
  19. return dispatch => {
  20. dispatch({ type: LIB_DISPOSED });
  21. return Promise.resolve();
  22. };
  23. }
  24. /**
  25. * Initializes lib-jitsi-meet with passed configuration.
  26. *
  27. * @returns {Function}
  28. */
  29. export function initLib() {
  30. return (dispatch, getState) => {
  31. const config = getState()['features/base/lib-jitsi-meet'].config;
  32. if (!config) {
  33. throw new Error('Cannot initialize lib-jitsi-meet without config');
  34. }
  35. // XXX Temporary solution. Until conference.js hasn't been moved
  36. // to the react app we shouldn't use JitsiMeetJS from react app.
  37. return Promise.resolve();
  38. };
  39. }
  40. /**
  41. * Sets config.
  42. *
  43. * @param {Object} config - Config object accepted by JitsiMeetJS#init()
  44. * method.
  45. * @returns {{
  46. * type: SET_CONFIG,
  47. * config: Object
  48. * }}
  49. */
  50. export function setConfig(config) {
  51. return {
  52. type: SET_CONFIG,
  53. config
  54. };
  55. }