選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

actions.native.js 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /* @flow */
  2. import {
  3. CLEAR_TOOLBOX_TIMEOUT,
  4. SET_OVERFLOW_MENU_VISIBLE,
  5. SET_TOOLBAR_HOVERED,
  6. SET_TOOLBOX_ALWAYS_VISIBLE,
  7. SET_TOOLBOX_ENABLED,
  8. SET_TOOLBOX_TIMEOUT,
  9. SET_TOOLBOX_TIMEOUT_MS,
  10. SET_TOOLBOX_VISIBLE,
  11. TOGGLE_TOOLBOX_VISIBLE
  12. } from './actionTypes';
  13. /**
  14. * Signals that toolbox timeout should be cleared.
  15. *
  16. * @returns {{
  17. * type: CLEAR_TOOLBOX_TIMEOUT
  18. * }}
  19. */
  20. export function clearToolboxTimeout(): Object {
  21. return {
  22. type: CLEAR_TOOLBOX_TIMEOUT
  23. };
  24. }
  25. /**
  26. * Shows/hides the overflow menu.
  27. *
  28. * @param {boolean} visible - True to show it or false to hide it.
  29. * @returns {{
  30. * type: SET_OVERFLOW_MENU_VISIBLE,
  31. * visible: boolean
  32. * }}
  33. */
  34. export function setOverflowMenuVisible(visible: boolean): Object {
  35. return {
  36. type: SET_OVERFLOW_MENU_VISIBLE,
  37. visible
  38. };
  39. }
  40. /**
  41. * Signals that toolbar is hovered value should be changed.
  42. *
  43. * @param {boolean} hovered - Flag showing whether toolbar is hovered.
  44. * @returns {{
  45. * type: SET_TOOLBAR_HOVERED,
  46. * hovered: boolean
  47. * }}
  48. */
  49. export function setToolbarHovered(hovered: boolean): Object {
  50. return {
  51. type: SET_TOOLBAR_HOVERED,
  52. hovered
  53. };
  54. }
  55. /**
  56. * Signals that always visible toolbars value should be changed.
  57. *
  58. * @param {boolean} alwaysVisible - Value to be set in redux store.
  59. * @returns {{
  60. * type: SET_TOOLBOX_ALWAYS_VISIBLE,
  61. * alwaysVisible: boolean
  62. * }}
  63. */
  64. export function setToolboxAlwaysVisible(alwaysVisible: boolean): Object {
  65. return {
  66. type: SET_TOOLBOX_ALWAYS_VISIBLE,
  67. alwaysVisible
  68. };
  69. }
  70. /* eslint-disable flowtype/space-before-type-colon */
  71. /**
  72. * Enables/disables the toolbox.
  73. *
  74. * @param {boolean} enabled - True to enable the toolbox or false to disable it.
  75. * @returns {{
  76. * type: SET_TOOLBOX_ENABLED,
  77. * enabled: boolean
  78. * }}
  79. */
  80. export function setToolboxEnabled(enabled: boolean): Object {
  81. return {
  82. type: SET_TOOLBOX_ENABLED,
  83. enabled
  84. };
  85. }
  86. /**
  87. * Dispatches an action which sets new timeout and clears the previous one.
  88. *
  89. * @param {Function} handler - Function to be invoked after the timeout.
  90. * @param {number} timeoutMS - Delay.
  91. * @returns {{
  92. * type: SET_TOOLBOX_TIMEOUT,
  93. * handler: Function,
  94. * timeoutMS: number
  95. * }}
  96. */
  97. export function setToolboxTimeout(handler: Function, timeoutMS: number)
  98. : Object {
  99. return {
  100. type: SET_TOOLBOX_TIMEOUT,
  101. handler,
  102. timeoutMS
  103. };
  104. }
  105. /* eslint-enable flowtype/space-before-type-colon */
  106. /**
  107. * Dispatches an action which sets new toolbox timeout value.
  108. *
  109. * @param {number} timeoutMS - Delay.
  110. * @returns {{
  111. * type: SET_TOOLBOX_TIMEOUT_MS,
  112. * timeoutMS: number
  113. * }}
  114. */
  115. export function setToolboxTimeoutMS(timeoutMS: number): Object {
  116. return {
  117. type: SET_TOOLBOX_TIMEOUT_MS,
  118. timeoutMS
  119. };
  120. }
  121. /**
  122. * Shows/hides the toolbox.
  123. *
  124. * @param {boolean} visible - True to show the toolbox or false to hide it.
  125. * @returns {{
  126. * type: SET_TOOLBOX_VISIBLE,
  127. * visible: boolean
  128. * }}
  129. */
  130. export function setToolboxVisible(visible: boolean): Object {
  131. return {
  132. type: SET_TOOLBOX_VISIBLE,
  133. visible
  134. };
  135. }
  136. /**
  137. * Action to toggle the toolbox visibility.
  138. *
  139. * @returns {{
  140. * type: TOGGLE_TOOLBOX_VISIBLE
  141. * }}
  142. */
  143. export function toggleToolboxVisible() {
  144. return {
  145. type: TOGGLE_TOOLBOX_VISIBLE
  146. };
  147. }