Sfoglia il codice sorgente

[eslint] sort-vars

dev1
Lyubo Marinov 8 anni fa
parent
commit
b5b0e95b4e

+ 1
- 0
.eslintrc.js Vedi File

158
         'quote-props': 0,
158
         'quote-props': 0,
159
         'semi': [ 'error', 'always' ],
159
         'semi': [ 'error', 'always' ],
160
         'semi-spacing': 2,
160
         'semi-spacing': 2,
161
+        'sort-vars': 2,
161
         'space-before-blocks': 2,
162
         'space-before-blocks': 2,
162
         'space-before-function-paren': [ 'error', 'never' ],
163
         'space-before-function-paren': [ 'error', 'never' ],
163
         'space-in-parens': [ 'error', 'never' ],
164
         'space-in-parens': [ 'error', 'never' ],

+ 5
- 6
JitsiMeetJS.js Vedi File

98
     mediaDevices: JitsiMediaDevices,
98
     mediaDevices: JitsiMediaDevices,
99
     analytics: null,
99
     analytics: null,
100
     init(options) {
100
     init(options) {
101
-        let logObject, attr;
102
         Statistics.init(options);
101
         Statistics.init(options);
103
 
102
 
104
         this.analytics = Statistics.analytics;
103
         this.analytics = Statistics.analytics;
114
         // Log deployment-specific information, if available.
113
         // Log deployment-specific information, if available.
115
         if (window.jitsiRegionInfo
114
         if (window.jitsiRegionInfo
116
             && Object.keys(window.jitsiRegionInfo).length > 0) {
115
             && Object.keys(window.jitsiRegionInfo).length > 0) {
117
-            logObject = {};
118
-            for (attr in window.jitsiRegionInfo) {
116
+            const logObject = {};
117
+            for (const attr in window.jitsiRegionInfo) {
119
                 if (window.jitsiRegionInfo.hasOwnProperty(attr)) {
118
                 if (window.jitsiRegionInfo.hasOwnProperty(attr)) {
120
                     logObject[attr] = window.jitsiRegionInfo[attr];
119
                     logObject[attr] = window.jitsiRegionInfo[attr];
121
                 }
120
                 }
126
         }
125
         }
127
 
126
 
128
         if(this.version) {
127
         if(this.version) {
129
-            logObject = {
128
+            const logObject = {
130
                 id: "component_version",
129
                 id: "component_version",
131
                 component: "lib-jitsi-meet",
130
                 component: "lib-jitsi-meet",
132
                 version: this.version
131
                 version: this.version
272
                 promiseFulfilled = true;
271
                 promiseFulfilled = true;
273
 
272
 
274
                 if(error.name === JitsiTrackErrors.UNSUPPORTED_RESOLUTION) {
273
                 if(error.name === JitsiTrackErrors.UNSUPPORTED_RESOLUTION) {
275
-                    var oldResolution = options.resolution || '360',
276
-                        newResolution = getLowerResolution(oldResolution);
274
+                    const oldResolution = options.resolution || '360';
275
+                    const newResolution = getLowerResolution(oldResolution);
277
 
276
 
278
                     if (newResolution !== null) {
277
                     if (newResolution !== null) {
279
                         options.resolution = newResolution;
278
                         options.resolution = newResolution;

+ 4
- 4
modules/RTC/JitsiLocalTrack.js Vedi File

212
  *  enumerateDevices() call
212
  *  enumerateDevices() call
213
  */
213
  */
214
 JitsiLocalTrack.prototype._setRealDeviceIdFromDeviceList = function(devices) {
214
 JitsiLocalTrack.prototype._setRealDeviceIdFromDeviceList = function(devices) {
215
-    var track = this.getTrack(),
216
-        device = devices.find(function(d) {
217
-            return d.kind === track.kind + 'input' && d.label === track.label;
218
-        });
215
+    const track = this.getTrack();
216
+    const device
217
+        = devices.find(
218
+            d => d.kind === track.kind + 'input' && d.label === track.label);
219
 
219
 
220
     if (device) {
220
     if (device) {
221
         this._realDeviceId = device.deviceId;
221
         this._realDeviceId = device.deviceId;

+ 10
- 15
modules/RTC/RTCUtils.js Vedi File

376
 
376
 
377
 /**
377
 /**
378
  * Event handler for the 'devicechange' event.
378
  * Event handler for the 'devicechange' event.
379
+ *
379
  * @param {MediaDeviceInfo[]} devices - list of media devices.
380
  * @param {MediaDeviceInfo[]} devices - list of media devices.
380
  * @emits RTCEvents.DEVICE_LIST_CHANGED
381
  * @emits RTCEvents.DEVICE_LIST_CHANGED
381
  */
382
  */
383
     currentlyAvailableMediaDevices = devicesReceived.slice(0);
384
     currentlyAvailableMediaDevices = devicesReceived.slice(0);
384
     logger.info('list of media devices has changed:', currentlyAvailableMediaDevices);
385
     logger.info('list of media devices has changed:', currentlyAvailableMediaDevices);
385
 
386
 
386
-    var videoInputDevices = currentlyAvailableMediaDevices.filter(function(d) {
387
-            return d.kind === 'videoinput';
388
-        }),
389
-        audioInputDevices = currentlyAvailableMediaDevices.filter(function(d) {
390
-            return d.kind === 'audioinput';
391
-        }),
392
-        videoInputDevicesWithEmptyLabels = videoInputDevices.filter(
393
-            function(d) {
394
-                return d.label === '';
395
-            }),
396
-        audioInputDevicesWithEmptyLabels = audioInputDevices.filter(
397
-            function(d) {
398
-                return d.label === '';
399
-            });
387
+    const videoInputDevices
388
+        = currentlyAvailableMediaDevices.filter(d => d.kind === 'videoinput');
389
+    const audioInputDevices
390
+        = currentlyAvailableMediaDevices.filter(d => d.kind === 'audioinput');
391
+    const videoInputDevicesWithEmptyLabels
392
+        = videoInputDevices.filter(d => d.label === '');
393
+    const audioInputDevicesWithEmptyLabels
394
+        = audioInputDevices.filter(d => d.label === '');
400
 
395
 
401
     if (videoInputDevices.length &&
396
     if (videoInputDevices.length &&
402
         videoInputDevices.length === videoInputDevicesWithEmptyLabels.length) {
397
         videoInputDevices.length === videoInputDevicesWithEmptyLabels.length) {
575
  * @returns {*[]} object that describes the new streams
570
  * @returns {*[]} object that describes the new streams
576
  */
571
  */
577
 function handleLocalStream(streams, resolution) {
572
 function handleLocalStream(streams, resolution) {
578
-    var audioStream, videoStream, desktopStream, res = [];
573
+    var audioStream, desktopStream, res = [], videoStream;
579
 
574
 
580
     // XXX The function obtainAudioAndVideoPermissions has examined the type of
575
     // XXX The function obtainAudioAndVideoPermissions has examined the type of
581
     // the browser, its capabilities, etc. and has taken the decision whether to
576
     // the browser, its capabilities, etc. and has taken the decision whether to

+ 7
- 14
modules/statistics/RTPStatsCollector.js Vedi File

337
         // example, if item has a stat property of type function, then it's very
337
         // example, if item has a stat property of type function, then it's very
338
         // likely that whoever defined it wanted you to call it in order to
338
         // likely that whoever defined it wanted you to call it in order to
339
         // retrieve the value associated with a specific key.
339
         // retrieve the value associated with a specific key.
340
-        itemStatByKey = function(item, key) {
341
-            return item.stat(key); 
342
-        };
340
+        itemStatByKey = (item, key) => item.stat(key);
343
         break;
341
         break;
344
     case RTCBrowserType.RTC_BROWSER_REACT_NATIVE:
342
     case RTCBrowserType.RTC_BROWSER_REACT_NATIVE:
345
         // The implementation provided by react-native-webrtc follows the
343
         // The implementation provided by react-native-webrtc follows the
359
         };
357
         };
360
         break;
358
         break;
361
     default:
359
     default:
362
-        itemStatByKey = function(item, key) {
363
-            return item[key]; 
364
-        };
360
+        itemStatByKey = (item, key) => item[key];
365
     }
361
     }
366
 
362
 
367
     // Compose the 2 functions defined above to get a function which retrieves
363
     // Compose the 2 functions defined above to get a function which retrieves
409
         } catch(e) {/* not supported*/}
405
         } catch(e) {/* not supported*/}
410
 
406
 
411
         if(now.type == 'googCandidatePair') {
407
         if(now.type == 'googCandidatePair') {
412
-            var ip, type, localip, active;
408
+            var active, ip, localip, type;
413
             try {
409
             try {
414
                 ip = getStatValue(now, 'remoteAddress');
410
                 ip = getStatValue(now, 'remoteAddress');
415
                 type = getStatValue(now, "transportType");
411
                 type = getStatValue(now, "transportType");
421
             }
417
             }
422
             // Save the address unless it has been saved already.
418
             // Save the address unless it has been saved already.
423
             var conferenceStatsTransport = this.conferenceStats.transport;
419
             var conferenceStatsTransport = this.conferenceStats.transport;
424
-            if(!conferenceStatsTransport.some(function(t) {
425
-                return (
426
-                        t.ip == ip && t.type == type && t.localip == localip
427
-                );
428
-            })) {
429
-                conferenceStatsTransport.push(
430
-                    {ip, type, localip});
420
+            if(!conferenceStatsTransport.some(
421
+                    t =>
422
+                        t.ip == ip && t.type == type && t.localip == localip)) {
423
+                conferenceStatsTransport.push({ip, type, localip});
431
             }
424
             }
432
             continue;
425
             continue;
433
         }
426
         }

+ 5
- 5
modules/xmpp/SDP.js Vedi File

104
 
104
 
105
 // remove iSAC and CN from SDP
105
 // remove iSAC and CN from SDP
106
 SDP.prototype.mangle = function() {
106
 SDP.prototype.mangle = function() {
107
-    var i, j, mline, lines, rtpmap, newdesc;
107
+    var i, j, lines, mline, newdesc, rtpmap;
108
     for (i = 0; i < this.media.length; i++) {
108
     for (i = 0; i < this.media.length; i++) {
109
         lines = this.media[i].split('\r\n');
109
         lines = this.media[i].split('\r\n');
110
         lines.pop(); // remove empty last element
110
         lines.pop(); // remove empty last element
153
 
153
 
154
 // add content's to a jingle element
154
 // add content's to a jingle element
155
 SDP.prototype.toJingle = function(elem, thecreator) {
155
 SDP.prototype.toJingle = function(elem, thecreator) {
156
-    var i, j, k, mline, ssrc, rtpmap, tmp, lines;
156
+    var i, j, k, lines, mline, rtpmap, ssrc, tmp;
157
     // new bundle plan
157
     // new bundle plan
158
     lines = SDPUtil.find_lines(this.session, 'a=group:');
158
     lines = SDPUtil.find_lines(this.session, 'a=group:');
159
     if (lines.length) {
159
     if (lines.length) {
356
 };
356
 };
357
 
357
 
358
 SDP.prototype.transportToJingle = function(mediaindex, elem) {
358
 SDP.prototype.transportToJingle = function(mediaindex, elem) {
359
-    var tmp, sctpmap, sctpAttrs, fingerprints;
359
+    var fingerprints, sctpAttrs, sctpmap, tmp;
360
     var self = this;
360
     var self = this;
361
     elem.c('transport');
361
     elem.c('transport');
362
 
362
 
495
 
495
 
496
 // translate a jingle content element into an an SDP media part
496
 // translate a jingle content element into an an SDP media part
497
 SDP.prototype.jingle2media = function(content) {
497
 SDP.prototype.jingle2media = function(content) {
498
-    var media = '',
499
-        desc = content.find('description'),
498
+    var desc = content.find('description'),
499
+        media = '',
500
         self = this,
500
         self = this,
501
         tmp;
501
         tmp;
502
     var sctp = content.find(
502
     var sctp = content.find(

+ 16
- 14
modules/xmpp/SDPUtil.js Vedi File

11
     },
11
     },
12
     iceparams(mediadesc, sessiondesc) {
12
     iceparams(mediadesc, sessiondesc) {
13
         var data = null;
13
         var data = null;
14
-        var ufrag, pwd;
14
+        var pwd, ufrag;
15
         if ((ufrag = SDPUtil.find_line(mediadesc, 'a=ice-ufrag:', sessiondesc))
15
         if ((ufrag = SDPUtil.find_line(mediadesc, 'a=ice-ufrag:', sessiondesc))
16
                 && (pwd = SDPUtil.find_line(mediadesc, 'a=ice-pwd:', sessiondesc))) {
16
                 && (pwd = SDPUtil.find_line(mediadesc, 'a=ice-pwd:', sessiondesc))) {
17
             data = {
17
             data = {
37
         return line.substring(6);
37
         return line.substring(6);
38
     },
38
     },
39
     parse_mline(line) {
39
     parse_mline(line) {
40
-        var parts = line.substring(2).split(' '),
41
-            data = {};
40
+        var data = {},
41
+            parts = line.substring(2).split(' ');
42
         data.media = parts.shift();
42
         data.media = parts.shift();
43
         data.port = parts.shift();
43
         data.port = parts.shift();
44
         data.proto = parts.shift();
44
         data.proto = parts.shift();
52
         return 'm=' + mline.media + ' ' + mline.port + ' ' + mline.proto + ' ' + mline.fmt.join(' ');
52
         return 'm=' + mline.media + ' ' + mline.port + ' ' + mline.proto + ' ' + mline.fmt.join(' ');
53
     },
53
     },
54
     parse_rtpmap(line) {
54
     parse_rtpmap(line) {
55
-        var parts = line.substring(9).split(' '),
56
-            data = {};
55
+        var data = {},
56
+            parts = line.substring(9).split(' ');
57
         data.id = parts.shift();
57
         data.id = parts.shift();
58
         parts = parts[0].split('/');
58
         parts = parts[0].split('/');
59
         data.name = parts.shift();
59
         data.name = parts.shift();
82
         return line;
82
         return line;
83
     },
83
     },
84
     parse_crypto(line) {
84
     parse_crypto(line) {
85
-        var parts = line.substring(9).split(' '),
86
-            data = {};
85
+        var data = {},
86
+            parts = line.substring(9).split(' ');
87
         data.tag = parts.shift();
87
         data.tag = parts.shift();
88
         data['crypto-suite'] = parts.shift();
88
         data['crypto-suite'] = parts.shift();
89
         data['key-params'] = parts.shift();
89
         data['key-params'] = parts.shift();
93
         return data;
93
         return data;
94
     },
94
     },
95
     parse_fingerprint(line) { // RFC 4572
95
     parse_fingerprint(line) { // RFC 4572
96
-        var parts = line.substring(14).split(' '),
97
-            data = {};
96
+        var data = {},
97
+            parts = line.substring(14).split(' ');
98
         data.hash = parts.shift();
98
         data.hash = parts.shift();
99
         data.fingerprint = parts.shift();
99
         data.fingerprint = parts.shift();
100
         // TODO assert that fingerprint satisfies 2UHEX *(":" 2UHEX) ?
100
         // TODO assert that fingerprint satisfies 2UHEX *(":" 2UHEX) ?
101
         return data;
101
         return data;
102
     },
102
     },
103
     parse_fmtp(line) {
103
     parse_fmtp(line) {
104
-        var parts = line.split(' '),
105
-            i, key, value,
106
-            data = [];
104
+        var data = [],
105
+            i,
106
+            key,
107
+            parts = line.split(' '),
108
+            value;
107
         parts.shift();
109
         parts.shift();
108
         parts = parts.join(' ').split(';');
110
         parts = parts.join(' ').split(';');
109
         for (i = 0; i < parts.length; i++) {
111
         for (i = 0; i < parts.length; i++) {
189
         // proprietary mapping of a=ssrc lines
191
         // proprietary mapping of a=ssrc lines
190
         // TODO: see "Jingle RTP Source Description" by Juberti and P. Thatcher on google docs
192
         // TODO: see "Jingle RTP Source Description" by Juberti and P. Thatcher on google docs
191
         // and parse according to that
193
         // and parse according to that
192
-        var lines = desc.split('\r\n'),
193
-            data = {};
194
+        var data = {},
195
+            lines = desc.split('\r\n');
194
         for (var i = 0; i < lines.length; i++) {
196
         for (var i = 0; i < lines.length; i++) {
195
             if (lines[i].substring(0, 7) == 'a=ssrc:') {
197
             if (lines[i].substring(0, 7) == 'a=ssrc:') {
196
                 var idx = lines[i].indexOf(' ');
198
                 var idx = lines[i].indexOf(' ');

Loading…
Annulla
Salva