Parcourir la source

[RN] Prepare for modifications to unsupported-browser

j8
Lyubo Marinov il y a 8 ans
Parent
révision
ec95956e25
1 fichiers modifiés avec 22 ajouts et 9 suppressions
  1. 22
    9
      react/features/base/lib-jitsi-meet/actions.js

+ 22
- 9
react/features/base/lib-jitsi-meet/actions.js Voir le fichier

@@ -38,10 +38,10 @@ export function disposeLib() {
38 38
  */
39 39
 export function initLib() {
40 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 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 47
         // XXX Temporarily until conference.js is moved to the React app we
@@ -53,23 +53,36 @@ export function initLib() {
53 53
         return JitsiMeetJS.init(config)
54 54
             .then(() => dispatch({ type: LIB_INITIALIZED }))
55 55
             .catch(error => {
56
-                dispatch({
57
-                    type: LIB_INIT_ERROR,
58
-                    error
59
-                });
56
+                dispatch(libInitError(error));
60 57
 
61 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 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 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 86
  * @returns {{
74 87
  *     type: SET_CONFIG,
75 88
  *     config: Object

Chargement…
Annuler
Enregistrer