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

functions.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import {
  2. LoginDialog,
  3. WaitForOwnerDialog
  4. } from './components/index';
  5. import { hideDialog } from '../base/dialog/actions';
  6. /**
  7. * Will clear the wait for conference owner timeout handler if any is currently
  8. * set.
  9. *
  10. * @param {Object} store - The Redux store instance.
  11. * @returns {void}
  12. */
  13. export function clearExistingWaitForOwnerTimeout(store) {
  14. const { waitForOwnerTimeoutID }
  15. = store.getState()['features/authentication'];
  16. if (waitForOwnerTimeoutID) {
  17. clearTimeout(waitForOwnerTimeoutID);
  18. }
  19. }
  20. /**
  21. * Checks if {@link LoginDialog} is currently open.
  22. *
  23. * @param {Object|Function} getStateOrState - The Redux store instance or
  24. * store's get state method.
  25. * @returns {boolean}
  26. */
  27. export function isLoginDialogOpened(getStateOrState) {
  28. const state
  29. = typeof getStateOrState === 'function'
  30. ? getStateOrState() : getStateOrState;
  31. const dialogState = state['features/base/dialog'];
  32. return dialogState.component && dialogState.component === LoginDialog;
  33. }
  34. /**
  35. * Hides {@link LoginDialog} if it's currently displayed.
  36. *
  37. * @param {Object} store - The Redux store instance.
  38. * @returns {void}
  39. */
  40. export function hideLoginDialog({ dispatch, getState }) {
  41. if (isLoginDialogOpened(getState)) {
  42. dispatch(hideDialog());
  43. }
  44. }
  45. /**
  46. * Checks if {@link WaitForOwnerDialog} is currently open.
  47. *
  48. * @param {Object} store - The Redux store instance.
  49. * @returns {boolean}
  50. */
  51. export function isWaitForOwnerDialogOpened({ getState }) {
  52. const dialogState = getState()['features/base/dialog'];
  53. return dialogState.component
  54. && dialogState.component === WaitForOwnerDialog;
  55. }
  56. /**
  57. * Checks if the cyclic "wait for conference owner" task is currently scheduled.
  58. *
  59. * @param {Object} store - The Redux store instance.
  60. * @returns {boolean}
  61. */
  62. export function isWaitingForOwner({ getState }) {
  63. const { waitForOwnerTimeoutID } = getState()['features/authentication'];
  64. return Boolean(waitForOwnerTimeoutID);
  65. }