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.native.js 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. // clog("ACTIONS NATIVE setOverflowMenuVisible",visible)
  36. // window.dev_fn ? dev_fn("setOverflowMenuVisible",{that:this,visible}) : 0
  37. return {
  38. type: SET_OVERFLOW_MENU_VISIBLE,
  39. visible
  40. };
  41. }
  42. /**
  43. * Signals that toolbar is hovered value should be changed.
  44. *
  45. * @param {boolean} hovered - Flag showing whether toolbar is hovered.
  46. * @returns {{
  47. * type: SET_TOOLBAR_HOVERED,
  48. * hovered: boolean
  49. * }}
  50. */
  51. export function setToolbarHovered(hovered: boolean): Object {
  52. return {
  53. type: SET_TOOLBAR_HOVERED,
  54. hovered
  55. };
  56. }
  57. /**
  58. * Signals that always visible toolbars value should be changed.
  59. *
  60. * @param {boolean} alwaysVisible - Value to be set in redux store.
  61. * @returns {{
  62. * type: SET_TOOLBOX_ALWAYS_VISIBLE,
  63. * alwaysVisible: boolean
  64. * }}
  65. */
  66. export function setToolboxAlwaysVisible(alwaysVisible: boolean): Object {
  67. return {
  68. type: SET_TOOLBOX_ALWAYS_VISIBLE,
  69. alwaysVisible
  70. };
  71. }
  72. /* eslint-disable flowtype/space-before-type-colon */
  73. /**
  74. * Enables/disables the toolbox.
  75. *
  76. * @param {boolean} enabled - True to enable the toolbox or false to disable it.
  77. * @returns {{
  78. * type: SET_TOOLBOX_ENABLED,
  79. * enabled: boolean
  80. * }}
  81. */
  82. export function setToolboxEnabled(enabled: boolean): Object {
  83. return {
  84. type: SET_TOOLBOX_ENABLED,
  85. enabled
  86. };
  87. }
  88. /**
  89. * Dispatches an action which sets new timeout and clears the previous one.
  90. *
  91. * @param {Function} handler - Function to be invoked after the timeout.
  92. * @param {number} timeoutMS - Delay.
  93. * @returns {{
  94. * type: SET_TOOLBOX_TIMEOUT,
  95. * handler: Function,
  96. * timeoutMS: number
  97. * }}
  98. */
  99. export function setToolboxTimeout(handler: Function, timeoutMS: number)
  100. : Object {
  101. return {
  102. type: SET_TOOLBOX_TIMEOUT,
  103. handler,
  104. timeoutMS
  105. };
  106. }
  107. /* eslint-enable flowtype/space-before-type-colon */
  108. /**
  109. * Dispatches an action which sets new toolbox timeout value.
  110. *
  111. * @param {number} timeoutMS - Delay.
  112. * @returns {{
  113. * type: SET_TOOLBOX_TIMEOUT_MS,
  114. * timeoutMS: number
  115. * }}
  116. */
  117. export function setToolboxTimeoutMS(timeoutMS: number): Object {
  118. return {
  119. type: SET_TOOLBOX_TIMEOUT_MS,
  120. timeoutMS
  121. };
  122. }
  123. /**
  124. * Shows/hides the toolbox.
  125. *
  126. * @param {boolean} visible - True to show the toolbox or false to hide it.
  127. * @returns {{
  128. * type: SET_TOOLBOX_VISIBLE,
  129. * visible: boolean
  130. * }}
  131. */
  132. export function setToolboxVisible(visible: boolean): Object {
  133. return {
  134. type: SET_TOOLBOX_VISIBLE,
  135. visible
  136. };
  137. }
  138. /**
  139. * Action to toggle the toolbox visibility.
  140. *
  141. * @returns {{
  142. * type: TOGGLE_TOOLBOX_VISIBLE
  143. * }}
  144. */
  145. export function toggleToolboxVisible() {
  146. return {
  147. type: TOGGLE_TOOLBOX_VISIBLE
  148. };
  149. }
  150. // dev log
  151. clog("dev log3","anj")