浏览代码

[flow] Expand the coverage of flow-monitored files

j8
Lyubomir Marinov 8 年前
父节点
当前提交
b50f858556

+ 3
- 1
react/features/base/connection/functions.js 查看文件

1
+/* @flow */
2
+
1
 /**
3
 /**
2
  * Returns current domain.
4
  * Returns current domain.
3
  *
5
  *
5
  * state.
7
  * state.
6
  * @returns {(string|undefined)}
8
  * @returns {(string|undefined)}
7
  */
9
  */
8
-export function getDomain(stateOrGetState) {
10
+export function getDomain(stateOrGetState: Function | Object) {
9
     const state
11
     const state
10
         = typeof stateOrGetState === 'function'
12
         = typeof stateOrGetState === 'function'
11
             ? stateOrGetState()
13
             ? stateOrGetState()

+ 20
- 16
react/features/base/connection/reducer.js 查看文件

1
+/* @flow */
2
+
1
 import { ReducerRegistry, setStateProperty } from '../redux';
3
 import { ReducerRegistry, setStateProperty } from '../redux';
2
 
4
 
3
 import {
5
 import {
9
 /**
11
 /**
10
  * Reduces the Redux actions of the feature base/connection.
12
  * Reduces the Redux actions of the feature base/connection.
11
  */
13
  */
12
-ReducerRegistry.register('features/base/connection', (state = {}, action) => {
13
-    switch (action.type) {
14
-    case CONNECTION_DISCONNECTED:
15
-        return _connectionDisconnected(state, action);
14
+ReducerRegistry.register(
15
+    'features/base/connection',
16
+    (state: Object = {}, action: Object) => {
17
+        switch (action.type) {
18
+        case CONNECTION_DISCONNECTED:
19
+            return _connectionDisconnected(state, action);
16
 
20
 
17
-    case CONNECTION_ESTABLISHED:
18
-        return _connectionEstablished(state, action);
21
+        case CONNECTION_ESTABLISHED:
22
+            return _connectionEstablished(state, action);
19
 
23
 
20
-    case SET_DOMAIN:
21
-        return _setDomain(state, action);
22
-    }
24
+        case SET_DOMAIN:
25
+            return _setDomain(state, action);
26
+        }
23
 
27
 
24
-    return state;
25
-});
28
+        return state;
29
+    });
26
 
30
 
27
 /**
31
 /**
28
  * Reduces a specific Redux action CONNECTION_DISCONNECTED of the feature
32
  * Reduces a specific Redux action CONNECTION_DISCONNECTED of the feature
34
  * @returns {Object} The new state of the feature base/connection after the
38
  * @returns {Object} The new state of the feature base/connection after the
35
  * reduction of the specified action.
39
  * reduction of the specified action.
36
  */
40
  */
37
-function _connectionDisconnected(state, action) {
41
+function _connectionDisconnected(state: Object, action: Object) {
38
     if (state.connection === action.connection) {
42
     if (state.connection === action.connection) {
39
         return setStateProperty(state, 'connection', undefined);
43
         return setStateProperty(state, 'connection', undefined);
40
     }
44
     }
52
  * @returns {Object} The new state of the feature base/connection after the
56
  * @returns {Object} The new state of the feature base/connection after the
53
  * reduction of the specified action.
57
  * reduction of the specified action.
54
  */
58
  */
55
-function _connectionEstablished(state, action) {
59
+function _connectionEstablished(state: Object, action: Object) {
56
     return setStateProperty(state, 'connection', action.connection);
60
     return setStateProperty(state, 'connection', action.connection);
57
 }
61
 }
58
 
62
 
65
  * @private
69
  * @private
66
  * @returns {Object}
70
  * @returns {Object}
67
  */
71
  */
68
-function _constructConnectionOptions(domain) {
72
+function _constructConnectionOptions(domain: string) {
69
     // FIXME The HTTPS scheme for the BOSH URL works with meet.jit.si on both
73
     // FIXME The HTTPS scheme for the BOSH URL works with meet.jit.si on both
70
     // mobile & Web. It also works with beta.meet.jit.si on Web. Unfortunately,
74
     // mobile & Web. It also works with beta.meet.jit.si on Web. Unfortunately,
71
     // it doesn't work with beta.meet.jit.si on mobile. Temporarily, use the
75
     // it doesn't work with beta.meet.jit.si on mobile. Temporarily, use the
89
     boshProtocol || (boshProtocol = 'https:');
93
     boshProtocol || (boshProtocol = 'https:');
90
 
94
 
91
     return {
95
     return {
92
-        bosh: `${boshProtocol}//${domain}/http-bind`,
96
+        bosh: `${String(boshProtocol)}//${domain}/http-bind`,
93
         hosts: {
97
         hosts: {
94
             domain,
98
             domain,
95
             focus: `focus.${domain}`,
99
             focus: `focus.${domain}`,
107
  * @returns {Object} The new state of the feature base/connection after the
111
  * @returns {Object} The new state of the feature base/connection after the
108
  * reduction of the specified action.
112
  * reduction of the specified action.
109
  */
113
  */
110
-function _setDomain(state, action) {
114
+function _setDomain(state: Object, action: Object) {
111
     return {
115
     return {
112
         ...state,
116
         ...state,
113
         connectionOptions: {
117
         connectionOptions: {

+ 2
- 0
react/features/base/media/middleware.js 查看文件

1
+/* @flow */
2
+
1
 import { CONFERENCE_LEFT } from '../conference';
3
 import { CONFERENCE_LEFT } from '../conference';
2
 import { MiddlewareRegistry } from '../redux';
4
 import { MiddlewareRegistry } from '../redux';
3
 import { setTrackMuted, TRACK_ADDED } from '../tracks';
5
 import { setTrackMuted, TRACK_ADDED } from '../tracks';

+ 1
- 1
react/features/base/react/RouteRegistry.js 查看文件

19
  * without needing to create additional inter-feature dependencies.
19
  * without needing to create additional inter-feature dependencies.
20
  */
20
  */
21
 class RouteRegistry {
21
 class RouteRegistry {
22
-    _elements: Route[];
22
+    _elements: Array<Route>;
23
 
23
 
24
     /**
24
     /**
25
      * Initializes a new RouteRegistry instance.
25
      * Initializes a new RouteRegistry instance.

+ 4
- 2
react/features/base/tracks/middleware.js 查看文件

1
+/* @flow */
2
+
1
 import { LIB_DISPOSED, LIB_INITIALIZED } from '../lib-jitsi-meet';
3
 import { LIB_DISPOSED, LIB_INITIALIZED } from '../lib-jitsi-meet';
2
 import {
4
 import {
3
     MEDIA_TYPE,
5
     MEDIA_TYPE,
67
  * @returns {Track} The local <tt>Track</tt> associated with the specified
69
  * @returns {Track} The local <tt>Track</tt> associated with the specified
68
  * <tt>mediaType</tt> in the specified <tt>store</tt>.
70
  * <tt>mediaType</tt> in the specified <tt>store</tt>.
69
  */
71
  */
70
-function _getLocalTrack(store, mediaType) {
72
+function _getLocalTrack(store, mediaType: MEDIA_TYPE) {
71
     return getLocalTrack(store.getState()['features/base/tracks'], mediaType);
73
     return getLocalTrack(store.getState()['features/base/tracks'], mediaType);
72
 }
74
 }
73
 
75
 
82
  * @private
84
  * @private
83
  * @returns {void}
85
  * @returns {void}
84
  */
86
  */
85
-function _setMuted(store, action, mediaType) {
87
+function _setMuted(store, action, mediaType: MEDIA_TYPE) {
86
     const localTrack = _getLocalTrack(store, mediaType);
88
     const localTrack = _getLocalTrack(store, mediaType);
87
 
89
 
88
     localTrack && setTrackMuted(localTrack.jitsiTrack, action.muted);
90
     localTrack && setTrackMuted(localTrack.jitsiTrack, action.muted);

+ 1
- 1
react/features/base/util/roomnameGenerator.js 查看文件

152
  * Maps a string (category name) to the array of words from that category.
152
  * Maps a string (category name) to the array of words from that category.
153
  * @const
153
  * @const
154
  */
154
  */
155
-const CATEGORIES = {
155
+const CATEGORIES: { [key: string]: Array<string> } = {
156
     _ADJECTIVE_,
156
     _ADJECTIVE_,
157
     _ADVERB_,
157
     _ADVERB_,
158
     _PLURALNOUN_,
158
     _PLURALNOUN_,

正在加载...
取消
保存