Browse Source

[RN] Prepare for modifications to unsupported-browser

j8
Lyubo Marinov 8 years ago
parent
commit
ec95956e25
1 changed files with 22 additions and 9 deletions
  1. 22
    9
      react/features/base/lib-jitsi-meet/actions.js

+ 22
- 9
react/features/base/lib-jitsi-meet/actions.js View File

38
  */
38
  */
39
 export function initLib() {
39
 export function initLib() {
40
     return (dispatch: Dispatch<*>, getState: Function) => {
40
     return (dispatch: Dispatch<*>, getState: Function) => {
41
-        const config = getState()['features/base/lib-jitsi-meet'].config;
41
+        const { config } = getState()['features/base/lib-jitsi-meet'];
42
 
42
 
43
         if (!config) {
43
         if (!config) {
44
-            throw new Error('Cannot initialize lib-jitsi-meet without config');
44
+            throw new Error('Cannot init lib-jitsi-meet without config');
45
         }
45
         }
46
 
46
 
47
         // XXX Temporarily until conference.js is moved to the React app we
47
         // XXX Temporarily until conference.js is moved to the React app we
53
         return JitsiMeetJS.init(config)
53
         return JitsiMeetJS.init(config)
54
             .then(() => dispatch({ type: LIB_INITIALIZED }))
54
             .then(() => dispatch({ type: LIB_INITIALIZED }))
55
             .catch(error => {
55
             .catch(error => {
56
-                dispatch({
57
-                    type: LIB_INIT_ERROR,
58
-                    error
59
-                });
56
+                dispatch(libInitError(error));
60
 
57
 
61
                 // TODO Handle LIB_INIT_ERROR error somewhere instead.
58
                 // TODO Handle LIB_INIT_ERROR error somewhere instead.
62
-                console.error('lib-jitsi-meet failed to init due to ', error);
59
+                console.error('lib-jitsi-meet failed to init:', error);
63
                 throw error;
60
                 throw error;
64
             });
61
             });
65
     };
62
     };
66
 }
63
 }
67
 
64
 
65
+/**
66
+ * Notifies about a specific error raised by {@link JitsiMeetJS.init()}.
67
+ *
68
+ * @param {Error} error - The Error raised by JitsiMeetJS.init().
69
+ * @returns {{
70
+ *     type: LIB_INIT_ERROR,
71
+ *     error: Error
72
+ * }}
73
+ */
74
+export function libInitError(error: Error) {
75
+    return {
76
+        type: LIB_INIT_ERROR,
77
+        error
78
+    };
79
+}
80
+
68
 /**
81
 /**
69
  * Sets config.
82
  * Sets config.
70
  *
83
  *
71
- * @param {Object} config - Config object accepted by JitsiMeetJS#init()
72
- * method.
84
+ * @param {Object} config - The config(uration) object in the format accepted by
85
+ * the JitsiMeetJS.init() method.
73
  * @returns {{
86
  * @returns {{
74
  *     type: SET_CONFIG,
87
  *     type: SET_CONFIG,
75
  *     config: Object
88
  *     config: Object

Loading…
Cancel
Save