瀏覽代碼

don't use params to switch actionType

master
Radium Zheng 7 年之前
父節點
當前提交
337cea6488
共有 2 個檔案被更改,包括 30 行新增15 行删除
  1. 21
    10
      react/features/local-recording/actions.js
  2. 9
    5
      react/features/local-recording/middleware.js

+ 21
- 10
react/features/local-recording/actions.js 查看文件

7
     LOCAL_RECORDING_STATS_UPDATE
7
     LOCAL_RECORDING_STATS_UPDATE
8
 } from './actionTypes';
8
 } from './actionTypes';
9
 
9
 
10
+// The following two actions signal state changes in local recording engagement.
11
+// In other words, the events of the local WebWorker / MediaRecorder starting to
12
+// record and finishing recording.
13
+// Note that this is not the event fired when the users tries to start the
14
+// recording in the UI.
15
+
10
 /**
16
 /**
11
- * Signals state change in local recording engagement.
12
- * In other words, the events of the local WebWorker / MediaRecorder
13
- * starting to record and finishing recording.
14
- *
15
- * Note that this is not the event fired when the users tries to start
16
- * the recording in the UI.
17
+ * Signals that local recording has started.
17
  *
18
  *
18
- * @param {bool} isEngaged - Whether local recording is engaged or not.
19
  * @returns {{
19
  * @returns {{
20
  *     type: LOCAL_RECORDING_ENGAGED
20
  *     type: LOCAL_RECORDING_ENGAGED
21
- * }|{
21
+ * }}
22
+ */
23
+export function localRecordingEngaged() {
24
+    return {
25
+        type: LOCAL_RECORDING_ENGAGED
26
+    };
27
+}
28
+
29
+/**
30
+ * Signals that local recording has finished.
31
+ *
32
+ * @returns {{
22
  *     type: LOCAL_RECORDING_UNENGAGED
33
  *     type: LOCAL_RECORDING_UNENGAGED
23
  * }}
34
  * }}
24
  */
35
  */
25
-export function signalLocalRecordingEngagement(isEngaged: boolean) {
36
+export function localRecordingUnengaged() {
26
     return {
37
     return {
27
-        type: isEngaged ? LOCAL_RECORDING_ENGAGED : LOCAL_RECORDING_UNENGAGED
38
+        type: LOCAL_RECORDING_UNENGAGED
28
     };
39
     };
29
 }
40
 }
30
 
41
 

+ 9
- 5
react/features/local-recording/middleware.js 查看文件

6
 import { MiddlewareRegistry } from '../base/redux';
6
 import { MiddlewareRegistry } from '../base/redux';
7
 import { showNotification } from '../notifications';
7
 import { showNotification } from '../notifications';
8
 
8
 
9
+import { localRecordingEngaged, localRecordingUnengaged } from './actions';
9
 import { recordingController } from './controller';
10
 import { recordingController } from './controller';
10
-import { signalLocalRecordingEngagement } from './actions';
11
 
11
 
12
 MiddlewareRegistry.register(({ getState, dispatch }) => next => action => {
12
 MiddlewareRegistry.register(({ getState, dispatch }) => next => action => {
13
     const result = next(action);
13
     const result = next(action);
20
         break;
20
         break;
21
     }
21
     }
22
     case APP_WILL_MOUNT:
22
     case APP_WILL_MOUNT:
23
-        // realize the delegates on recordingController,
24
-        // providing UI reactions.
25
-        recordingController.onStateChanged = function(state) {
26
-            dispatch(signalLocalRecordingEngagement(state));
23
+        // realize the delegates on recordingController, allowing the UI to
24
+        // react to state changes in recordingController.
25
+        recordingController.onStateChanged = function(isEngaged) {
26
+            if (isEngaged) {
27
+                dispatch(localRecordingEngaged());
28
+            } else {
29
+                dispatch(localRecordingUnengaged());
30
+            }
27
         };
31
         };
28
 
32
 
29
         recordingController.onWarning = function(message) {
33
         recordingController.onWarning = function(message) {

Loading…
取消
儲存