Selaa lähdekoodia

feat(UI): simplify code (#2847)

Avoid branching on the same condition and remove unneeded showToolbar call on
filmstrip only mode.
master
Saúl Ibarra Corretgé 7 vuotta sitten
vanhempi
commit
d7103c1c4c
1 muutettua tiedostoa jossa 14 lisäystä ja 18 poistoa
  1. 14
    18
      modules/UI/UI.js

+ 14
- 18
modules/UI/UI.js Näytä tiedosto

@@ -340,33 +340,29 @@ UI.start = function() {
340 340
     VideoLayout.resizeVideoArea(true, true);
341 341
 
342 342
     sharedVideoManager = new SharedVideoManager(eventEmitter);
343
-    // eslint-disable-next-line no-negated-condition
344
-    if (!interfaceConfig.filmStripOnly) {
345
-        // Initialise the recording module.
346
-        if (config.enableRecording) {
347
-            Recording.init(eventEmitter, config.recordingType);
348
-        }
349 343
 
350
-        // Initialize side panels
351
-        SidePanels.init(eventEmitter);
352
-    } else {
344
+    if (interfaceConfig.filmStripOnly) {
353 345
         $('body').addClass('filmstrip-only');
354
-        UI.showToolbar();
355 346
         Filmstrip.setFilmstripOnly();
356 347
         APP.store.dispatch(setNotificationsEnabled(false));
357
-    }
348
+    } else {
349
+        // Initialise the recording module.
350
+        config.enableRecording
351
+            && Recording.init(eventEmitter, config.recordingType);
358 352
 
359
-    if (interfaceConfig.VERTICAL_FILMSTRIP) {
360
-        $('body').addClass('vertical-filmstrip');
361
-    }
353
+        // Initialize side panels
354
+        SidePanels.init(eventEmitter);
362 355
 
363
-    // TODO: remove this class once the old toolbar has been removed. This class
364
-    // is set so that any CSS changes needed to adjust elements outside of the
365
-    // new toolbar can be scoped to just the app with the new toolbar enabled.
366
-    if (!interfaceConfig.filmStripOnly) {
356
+        // TODO: remove this class once the old toolbar has been removed. This
357
+        // class is set so that any CSS changes needed to adjust elements
358
+        // outside of the new toolbar can be scoped to just the app with the new
359
+        // toolbar enabled.
367 360
         $('body').addClass('use-new-toolbox');
368 361
     }
369 362
 
363
+    interfaceConfig.VERTICAL_FILMSTRIP
364
+        && $('body').addClass('vertical-filmstrip');
365
+
370 366
     document.title = interfaceConfig.APP_NAME;
371 367
 };
372 368
 

Loading…
Peruuta
Tallenna