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.js 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // @flow
  2. import {
  3. MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
  4. SET_FATAL_ERROR,
  5. SET_PAGE_RELOAD_OVERLAY_CANCELED,
  6. TOGGLE_SLOW_GUM_OVERLAY
  7. } from './actionTypes';
  8. /**
  9. * Signals that the prompt for media permission is visible or not.
  10. *
  11. * @param {boolean} isVisible - If the value is true - the prompt for media
  12. * permission is visible otherwise the value is false/undefined.
  13. * @param {string} browser - The name of the current browser.
  14. * @public
  15. * @returns {{
  16. * type: MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
  17. * browser: {string},
  18. * isVisible: {boolean}
  19. * }}
  20. */
  21. export function mediaPermissionPromptVisibilityChanged(isVisible: boolean, browser: string) {
  22. return {
  23. type: MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
  24. browser,
  25. isVisible
  26. };
  27. }
  28. /**
  29. * Signals that the prompt for media permission is visible or not.
  30. *
  31. * @param {boolean} isVisible - If the value is true - the prompt for media
  32. * permission is visible otherwise the value is false/undefined.
  33. * @public
  34. * @returns {{
  35. * type: SLOW_GET_USER_MEDIA_OVERLAY,
  36. * isVisible: {boolean}
  37. * }}
  38. */
  39. export function toggleSlowGUMOverlay(isVisible: boolean) {
  40. return {
  41. type: TOGGLE_SLOW_GUM_OVERLAY,
  42. isVisible
  43. };
  44. }
  45. /**
  46. * The action indicates that an unrecoverable error has occurred and the reload
  47. * screen will be displayed or hidden.
  48. *
  49. * @param {Object} fatalError - A critical error which was not claimed by any
  50. * feature for error recovery (the recoverable flag was not set). If
  51. * {@code undefined} then any fatal error currently stored will be discarded.
  52. * @returns {{
  53. * type: SET_FATAL_ERROR,
  54. * fatalError: ?Error
  55. * }}
  56. */
  57. export function setFatalError(fatalError: Object) {
  58. return {
  59. type: SET_FATAL_ERROR,
  60. fatalError
  61. };
  62. }
  63. /**
  64. * The action indicates that the overlay was canceled.
  65. *
  66. * @param {Object} error - The error that caused the display of the overlay.
  67. *
  68. * @returns {{
  69. * type: SET_PAGE_RELOAD_OVERLAY_CANCELED,
  70. * error: ?Error
  71. * }}
  72. */
  73. export function setPageReloadOverlayCanceled(error: Object) {
  74. return {
  75. type: SET_PAGE_RELOAD_OVERLAY_CANCELED,
  76. error
  77. };
  78. }