Parcourir la source

Removes redux compose utility function

j8
yanas il y a 8 ans
Parent
révision
a59e691ba8
2 fichiers modifiés avec 10 ajouts et 22 suppressions
  1. 0
    5
      flow-typed/npm/redux_v3.x.x.js
  2. 10
    17
      react/features/toolbox/actions.web.js

+ 0
- 5
flow-typed/npm/redux_v3.x.x.js Voir le fichier

@@ -54,9 +54,4 @@ declare module 'redux' {
54 54
   declare function combineReducers<O: Object, A>(reducers: O): CombinedReducer<$ObjMap<O, <S>(r: Reducer<S, any>) => S>, A>;
55 55
 
56 56
   declare function compose<S, A>(...fns: Array<StoreEnhancer<S, A>>): Function;
57
-
58
-  // Utility function in Redux that can be used for function composition
59
-  // e.g. bar(foo(baz)) is equivalent to compose(bar, foo)(baz).
60
-  declare function compose(...fns: Array<Function>): Function;
61
-
62 57
 }

+ 10
- 17
react/features/toolbox/actions.web.js Voir le fichier

@@ -1,12 +1,10 @@
1 1
 /* @flow */
2 2
 
3
-import { compose } from 'redux';
4
-
5 3
 import Recording from '../../../modules/UI/recording/Recording';
6 4
 import SideContainerToggler
7 5
     from '../../../modules/UI/side_pannels/SideContainerToggler';
8
-import UIEvents from '../../../service/UI/UIEvents';
9 6
 import UIUtil from '../../../modules/UI/util/UIUtil';
7
+import UIEvents from '../../../service/UI/UIEvents';
10 8
 
11 9
 import {
12 10
     changeLocalRaiseHand,
@@ -19,7 +17,6 @@ import {
19 17
     toggleFullScreen,
20 18
     toggleToolbarButton
21 19
 } from './actions.native';
22
-
23 20
 import { SET_DEFAULT_TOOLBOX_BUTTONS } from './actionTypes';
24 21
 import { getDefaultToolboxButtons } from './functions';
25 22
 
@@ -40,7 +37,6 @@ export function checkAutoEnableDesktopSharing(): Function {
40 37
     return () => {
41 38
         // XXX Should use dispatcher to toggle screensharing but screensharing
42 39
         // hasn't been React-ified yet.
43
-
44 40
         if (UIUtil.isButtonEnabled('desktop')
45 41
                 && config.autoEnableDesktopSharing) {
46 42
             APP.UI.eventEmitter.emit(UIEvents.TOGGLE_SCREENSHARING);
@@ -60,8 +56,7 @@ export function dockToolbox(dock: boolean): Function {
60 56
             return;
61 57
         }
62 58
 
63
-        const state = getState();
64
-        const { timeoutMS, visible } = state['features/toolbox'];
59
+        const { timeoutMS, visible } = getState()['features/toolbox'];
65 60
 
66 61
         if (dock) {
67 62
             // First make sure the toolbox is shown.
@@ -89,10 +84,10 @@ export function dockToolbox(dock: boolean): Function {
89 84
  * @private
90 85
  */
91 86
 function _getButtonHandlers(dispatch, getState) {
92
-    const { isGuest } = getState()['features/jwt'];
93
-
94
-    const localRaiseHandHandler = compose(dispatch, changeLocalRaiseHand);
95
-    const toggleFullScreenHandler = compose(dispatch, toggleFullScreen);
87
+    const localRaiseHandHandler
88
+        = (...args) => dispatch(changeLocalRaiseHand(...args));
89
+    const toggleFullScreenHandler
90
+        = (...args) => dispatch(toggleFullScreen(...args));
96 91
 
97 92
     return {
98 93
         /**
@@ -127,8 +122,8 @@ function _getButtonHandlers(dispatch, getState) {
127 122
          */
128 123
         profile: {
129 124
             onMount: () =>
130
-            isGuest
131
-            || dispatch(setProfileButtonUnclickable(true))
125
+                getState()['features/jwt']
126
+                    || dispatch(setProfileButtonUnclickable(true))
132 127
         },
133 128
 
134 129
         /**
@@ -154,8 +149,7 @@ function _getButtonHandlers(dispatch, getState) {
154 149
          */
155 150
         recording: {
156 151
             onMount: () =>
157
-            config.enableRecording
158
-            && dispatch(showRecordingButton())
152
+                config.enableRecording && dispatch(showRecordingButton())
159 153
         }
160 154
     };
161 155
 }
@@ -366,8 +360,7 @@ export function showToolbox(timeout: number = 0): Object {
366 360
  */
367 361
 export function toggleSideToolbarContainer(containerId: string): Function {
368 362
     return (dispatch: Dispatch, getState: Function) => {
369
-        const state = getState();
370
-        const { secondaryToolbarButtons } = state['features/toolbox'];
363
+        const { secondaryToolbarButtons } = getState()['features/toolbox'];
371 364
 
372 365
         for (const key of secondaryToolbarButtons.keys()) {
373 366
             const isButtonEnabled = UIUtil.isButtonEnabled(key);

Chargement…
Annuler
Enregistrer