Pārlūkot izejas kodu

Add jsdocs, apply manual formatting

https://github.com/jitsi/jitsi-meet/pull/1397 (React Toolbar) is huge at
the time of this writing. In order to reduce it, I'm extracting changes
not directly related to React-ifying the Toolbar such as added jsdocs
and source code formatting.
j8
Ilya Daynatovich 8 gadus atpakaļ
vecāks
revīzija
74b5638d99

+ 11
- 12
modules/UI/UI.js Parādīt failu

@@ -196,11 +196,11 @@ UI.setRaisedHandStatus = (participant, raisedHandStatus) => {
196 196
 /**
197 197
  * Sets the local "raised hand" status.
198 198
  */
199
-UI.setLocalRaisedHandStatus = (raisedHandStatus) => {
200
-    VideoLayout.setRaisedHandStatus(
199
+UI.setLocalRaisedHandStatus
200
+    = raisedHandStatus => 
201
+        VideoLayout.setRaisedHandStatus(
201 202
             APP.conference.getMyUserId(),
202 203
             raisedHandStatus);
203
-};
204 204
 
205 205
 /**
206 206
  * Initialize conference UI.
@@ -306,9 +306,12 @@ UI.start = function () {
306 306
 
307 307
     sharedVideoManager = new SharedVideoManager(eventEmitter);
308 308
     if (!interfaceConfig.filmStripOnly) {
309
-        let debouncedShowToolbar = debounce(() => {
310
-            UI.showToolbar();
311
-        }, 100, { leading: true, trailing: false });
309
+        let debouncedShowToolbar
310
+            = debounce(
311
+                    () => UI.showToolbar(),
312
+                    100,
313
+                    { leading: true, trailing: false });
314
+
312 315
         $("#videoconference_page").mousemove(debouncedShowToolbar);
313 316
         setupToolbars();
314 317
 
@@ -713,9 +716,7 @@ UI.removeListener = function (type, listener) {
713 716
  * @param type the type of the event we're emitting
714 717
  * @param options the parameters for the event
715 718
  */
716
-UI.emitEvent = function (type, options) {
717
-    eventEmitter.emit(type, options);
718
-};
719
+UI.emitEvent = (type, options) => eventEmitter.emit(type, options);
719 720
 
720 721
 UI.clickOnVideo = function (videoNumber) {
721 722
     let videos = $("#remoteVideos .videocontainer:not(#mixedstream)");
@@ -913,9 +914,7 @@ UI.promptDisplayName = () => {
913 914
  * @param {string} id user id
914 915
  * @param {number} lvl audio level
915 916
  */
916
-UI.setAudioLevel = function (id, lvl) {
917
-    VideoLayout.setAudioLevel(id, lvl);
918
-};
917
+UI.setAudioLevel = (id, lvl) => VideoLayout.setAudioLevel(id, lvl);
919 918
 
920 919
 /**
921 920
  * Update state of desktop sharing buttons.

+ 16
- 9
modules/UI/side_pannels/SidePanels.js Parādīt failu

@@ -6,19 +6,26 @@ import UIUtil from '../util/UIUtil';
6 6
 
7 7
 const SidePanels = {
8 8
     init (eventEmitter) {
9
-        //Initialize chat
10
-        if (UIUtil.isButtonEnabled('chat'))
9
+        // Initialize chat
10
+        if (UIUtil.isButtonEnabled('chat')) {
11 11
             Chat.init(eventEmitter);
12
-        //Initialize settings
13
-        if (UIUtil.isButtonEnabled('settings'))
12
+        }
13
+
14
+        // Initialize settings
15
+        if (UIUtil.isButtonEnabled('settings')) {
14 16
             SettingsMenu.init(eventEmitter);
15
-        //Initialize profile
16
-        if (UIUtil.isButtonEnabled('profile'))
17
+        }
18
+
19
+        // Initialize profile
20
+        if (UIUtil.isButtonEnabled('profile')) {
17 21
             Profile.init(eventEmitter);
18
-        //Initialize contact list view
19
-        if (UIUtil.isButtonEnabled('contacts'))
22
+        }
23
+
24
+        // Initialize contact list view
25
+        if (UIUtil.isButtonEnabled('contacts')) {
20 26
             ContactListView.init();
27
+        }
21 28
     }
22 29
 };
23 30
 
24
-export default SidePanels;
31
+export default SidePanels;

+ 23
- 12
modules/UI/side_pannels/chat/Chat.js Parādīt failu

@@ -49,30 +49,41 @@ var CHAT_CONTAINER_ID = "chat_container";
49 49
  *  Updates visual notification, indicating that a message has arrived.
50 50
  */
51 51
 function updateVisualNotification() {
52
-    var unreadMsgElement = document.getElementById('unreadMessages');
52
+    // XXX The rewrite of the toolbar in React delayed the availability of the
53
+    // element unreadMessages. In order to work around the delay, I introduced
54
+    // and utilized unreadMsgSelector in addition to unreadMsgElement.
55
+    const unreadMsgSelector = $('#unreadMessages');
56
+    const unreadMsgElement
57
+        = unreadMsgSelector.length > 0 ? unreadMsgSelector[0] : undefined;
53 58
 
54 59
     if (unreadMessages) {
55 60
         unreadMsgElement.innerHTML = unreadMessages.toString();
56 61
 
57 62
         ToolbarToggler.dockToolbar(true);
58 63
 
59
-        var chatButtonElement
64
+        const chatButtonElement
60 65
             = document.getElementById('toolbar_button_chat');
61
-        var leftIndent = (UIUtil.getTextWidth(chatButtonElement) -
62
-            UIUtil.getTextWidth(unreadMsgElement)) / 2;
63
-        var topIndent = (UIUtil.getTextHeight(chatButtonElement) -
64
-            UIUtil.getTextHeight(unreadMsgElement)) / 2 - 5;
66
+        const leftIndent
67
+            = (UIUtil.getTextWidth(chatButtonElement)
68
+                    - UIUtil.getTextWidth(unreadMsgElement))
69
+                / 2;
70
+        const topIndent
71
+            = (UIUtil.getTextHeight(chatButtonElement)
72
+                        - UIUtil.getTextHeight(unreadMsgElement))
73
+                    / 2
74
+                - 5;
65 75
 
66 76
         unreadMsgElement.setAttribute(
67
-            'style',
68
-                'top:' + topIndent +
69
-                '; left:' + leftIndent + ';');
77
+                'style',
78
+                'top:' + topIndent + '; left:' + leftIndent + ';');
70 79
     }
71 80
     else {
72
-        unreadMsgElement.innerHTML = '';
81
+        unreadMsgSelector.html('');
73 82
     }
74 83
 
75
-    $(unreadMsgElement).parent()[unreadMessages > 0 ? 'show' : 'hide']();
84
+    if (unreadMsgElement) {
85
+        unreadMsgSelector.parent()[unreadMessages > 0 ? 'show' : 'hide']();
86
+    }
76 87
 }
77 88
 
78 89
 
@@ -309,7 +320,7 @@ var Chat = {
309 320
         }
310 321
 
311 322
         let subjectId = 'subject';
312
-        let html = linkify(UIUtil.escapeHtml(subject));
323
+        const html = linkify(UIUtil.escapeHtml(subject));
313 324
         $(`#${subjectId}`).html(html);
314 325
         UIUtil.setVisible(subjectId, subject && subject.length > 0);
315 326
     },

+ 8
- 1
react/features/film-strip/components/FilmStrip.js Parādīt failu

@@ -26,6 +26,13 @@ class FilmStrip extends Component {
26 26
          * @type {Participant[]}
27 27
          */
28 28
         _participants: React.PropTypes.array,
29
+
30
+        /**
31
+         * The indicator which determines whether the film strip is visible.
32
+         *
33
+         * @private
34
+         * @type {boolean}
35
+         */
29 36
         visible: React.PropTypes.bool.isRequired
30 37
     }
31 38
 
@@ -101,7 +108,7 @@ class FilmStrip extends Component {
101 108
  * @param {Object} state - Redux state.
102 109
  * @private
103 110
  * @returns {{
104
- *      _participants: Participant[],
111
+ *     _participants: Participant[],
105 112
  *  }}
106 113
  */
107 114
 function _mapStateToProps(state) {

+ 12
- 0
react/features/toolbar/components/AbstractToolbarButton.js Parādīt failu

@@ -21,12 +21,24 @@ export default class AbstractToolbarButton extends Component {
21 21
          * The style of the Icon of this AbstractToolbarButton.
22 22
          */
23 23
         iconStyle: React.PropTypes.object,
24
+
25
+        /**
26
+         * On click handler.
27
+         */
24 28
         onClick: React.PropTypes.func,
29
+
30
+        /**
31
+         * Toolbar button styles.
32
+         */
25 33
         style:
26 34
             React.PropTypes.oneOfType([
27 35
                 React.PropTypes.array,
28 36
                 React.PropTypes.object
29 37
             ]),
38
+
39
+        /**
40
+         * The color underlaying the button.
41
+         */
30 42
         underlayColor: React.PropTypes.any
31 43
     }
32 44
 

+ 5
- 0
react/features/toolbar/components/Notice.js Parādīt failu

@@ -24,6 +24,11 @@ export default class Notice extends Component {
24 24
         const { noticeMessage } = config;
25 25
 
26 26
         this.state = {
27
+            /**
28
+             * Message to be shown in notice component.
29
+             *
30
+             * @type {string}
31
+             */
27 32
             noticeMessage
28 33
         };
29 34
     }

Notiek ielāde…
Atcelt
Saglabāt