Bladeren bron

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 jaren geleden
bovenliggende
commit
74b5638d99

+ 11
- 12
modules/UI/UI.js Bestand weergeven

196
 /**
196
 /**
197
  * Sets the local "raised hand" status.
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
             APP.conference.getMyUserId(),
202
             APP.conference.getMyUserId(),
202
             raisedHandStatus);
203
             raisedHandStatus);
203
-};
204
 
204
 
205
 /**
205
 /**
206
  * Initialize conference UI.
206
  * Initialize conference UI.
306
 
306
 
307
     sharedVideoManager = new SharedVideoManager(eventEmitter);
307
     sharedVideoManager = new SharedVideoManager(eventEmitter);
308
     if (!interfaceConfig.filmStripOnly) {
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
         $("#videoconference_page").mousemove(debouncedShowToolbar);
315
         $("#videoconference_page").mousemove(debouncedShowToolbar);
313
         setupToolbars();
316
         setupToolbars();
314
 
317
 
713
  * @param type the type of the event we're emitting
716
  * @param type the type of the event we're emitting
714
  * @param options the parameters for the event
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
 UI.clickOnVideo = function (videoNumber) {
721
 UI.clickOnVideo = function (videoNumber) {
721
     let videos = $("#remoteVideos .videocontainer:not(#mixedstream)");
722
     let videos = $("#remoteVideos .videocontainer:not(#mixedstream)");
913
  * @param {string} id user id
914
  * @param {string} id user id
914
  * @param {number} lvl audio level
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
  * Update state of desktop sharing buttons.
920
  * Update state of desktop sharing buttons.

+ 16
- 9
modules/UI/side_pannels/SidePanels.js Bestand weergeven

6
 
6
 
7
 const SidePanels = {
7
 const SidePanels = {
8
     init (eventEmitter) {
8
     init (eventEmitter) {
9
-        //Initialize chat
10
-        if (UIUtil.isButtonEnabled('chat'))
9
+        // Initialize chat
10
+        if (UIUtil.isButtonEnabled('chat')) {
11
             Chat.init(eventEmitter);
11
             Chat.init(eventEmitter);
12
-        //Initialize settings
13
-        if (UIUtil.isButtonEnabled('settings'))
12
+        }
13
+
14
+        // Initialize settings
15
+        if (UIUtil.isButtonEnabled('settings')) {
14
             SettingsMenu.init(eventEmitter);
16
             SettingsMenu.init(eventEmitter);
15
-        //Initialize profile
16
-        if (UIUtil.isButtonEnabled('profile'))
17
+        }
18
+
19
+        // Initialize profile
20
+        if (UIUtil.isButtonEnabled('profile')) {
17
             Profile.init(eventEmitter);
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
             ContactListView.init();
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 Bestand weergeven

49
  *  Updates visual notification, indicating that a message has arrived.
49
  *  Updates visual notification, indicating that a message has arrived.
50
  */
50
  */
51
 function updateVisualNotification() {
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
     if (unreadMessages) {
59
     if (unreadMessages) {
55
         unreadMsgElement.innerHTML = unreadMessages.toString();
60
         unreadMsgElement.innerHTML = unreadMessages.toString();
56
 
61
 
57
         ToolbarToggler.dockToolbar(true);
62
         ToolbarToggler.dockToolbar(true);
58
 
63
 
59
-        var chatButtonElement
64
+        const chatButtonElement
60
             = document.getElementById('toolbar_button_chat');
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
         unreadMsgElement.setAttribute(
76
         unreadMsgElement.setAttribute(
67
-            'style',
68
-                'top:' + topIndent +
69
-                '; left:' + leftIndent + ';');
77
+                'style',
78
+                'top:' + topIndent + '; left:' + leftIndent + ';');
70
     }
79
     }
71
     else {
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
         }
320
         }
310
 
321
 
311
         let subjectId = 'subject';
322
         let subjectId = 'subject';
312
-        let html = linkify(UIUtil.escapeHtml(subject));
323
+        const html = linkify(UIUtil.escapeHtml(subject));
313
         $(`#${subjectId}`).html(html);
324
         $(`#${subjectId}`).html(html);
314
         UIUtil.setVisible(subjectId, subject && subject.length > 0);
325
         UIUtil.setVisible(subjectId, subject && subject.length > 0);
315
     },
326
     },

+ 8
- 1
react/features/film-strip/components/FilmStrip.js Bestand weergeven

26
          * @type {Participant[]}
26
          * @type {Participant[]}
27
          */
27
          */
28
         _participants: React.PropTypes.array,
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
         visible: React.PropTypes.bool.isRequired
36
         visible: React.PropTypes.bool.isRequired
30
     }
37
     }
31
 
38
 
101
  * @param {Object} state - Redux state.
108
  * @param {Object} state - Redux state.
102
  * @private
109
  * @private
103
  * @returns {{
110
  * @returns {{
104
- *      _participants: Participant[],
111
+ *     _participants: Participant[],
105
  *  }}
112
  *  }}
106
  */
113
  */
107
 function _mapStateToProps(state) {
114
 function _mapStateToProps(state) {

+ 12
- 0
react/features/toolbar/components/AbstractToolbarButton.js Bestand weergeven

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

+ 5
- 0
react/features/toolbar/components/Notice.js Bestand weergeven

24
         const { noticeMessage } = config;
24
         const { noticeMessage } = config;
25
 
25
 
26
         this.state = {
26
         this.state = {
27
+            /**
28
+             * Message to be shown in notice component.
29
+             *
30
+             * @type {string}
31
+             */
27
             noticeMessage
32
             noticeMessage
28
         };
33
         };
29
     }
34
     }

Laden…
Annuleren
Opslaan