浏览代码

[eslint] require-jsdoc

dev1
Lyubo Marinov 8 年前
父节点
当前提交
de61af8b2d

+ 10
- 0
.eslintrc.js 查看文件

231
         'padded-blocks': 0,
231
         'padded-blocks': 0,
232
         'quote-props': 0,
232
         'quote-props': 0,
233
         'quotes': [ 'error', 'single' ],
233
         'quotes': [ 'error', 'single' ],
234
+        'require-jsdoc': [
235
+            'error',
236
+            {
237
+                'require': {
238
+                    'ClassDeclaration': true,
239
+                    'FunctionDeclaration': true,
240
+                    'MethodDefinition': true
241
+                }
242
+            }
243
+        ],
234
         'semi': [ 'error', 'always' ],
244
         'semi': [ 'error', 'always' ],
235
         'semi-spacing': 2,
245
         'semi-spacing': 2,
236
         'sort-vars': 2,
246
         'sort-vars': 2,

+ 4
- 0
JitsiMeetJS.js 查看文件

31
 // JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN event
31
 // JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN event
32
 const USER_MEDIA_PERMISSION_PROMPT_TIMEOUT = 500;
32
 const USER_MEDIA_PERMISSION_PROMPT_TIMEOUT = 500;
33
 
33
 
34
+/**
35
+ *
36
+ * @param resolution
37
+ */
34
 function getLowerResolution(resolution) {
38
 function getLowerResolution(resolution) {
35
     if (!Resolutions[resolution]) {
39
     if (!Resolutions[resolution]) {
36
         return null;
40
         return null;

+ 3
- 0
JitsiParticipant.js 查看文件

205
         return this._role;
205
         return this._role;
206
     }
206
     }
207
 
207
 
208
+    /**
209
+     *
210
+     */
208
     supportsDTMF() {
211
     supportsDTMF() {
209
         return this._supportsDTMF;
212
         return this._supportsDTMF;
210
     }
213
     }

+ 14
- 0
doc/example/example.js 查看文件

108
     }
108
     }
109
 }
109
 }
110
 
110
 
111
+/**
112
+ *
113
+ * @param id
114
+ */
111
 function onUserLeft(id) {
115
 function onUserLeft(id) {
112
     console.log('user left');
116
     console.log('user left');
113
     if (!remoteTracks[id]) {
117
     if (!remoteTracks[id]) {
190
         disconnect);
194
         disconnect);
191
 }
195
 }
192
 
196
 
197
+/**
198
+ *
199
+ */
193
 function unload() {
200
 function unload() {
194
     for (let i = 0; i < localTracks.length; i++) {
201
     for (let i = 0; i < localTracks.length; i++) {
195
         localTracks[i].stop();
202
         localTracks[i].stop();
200
 
207
 
201
 let isVideo = true;
208
 let isVideo = true;
202
 
209
 
210
+/**
211
+ *
212
+ */
203
 function switchVideo() { // eslint-disable-line no-unused-vars
213
 function switchVideo() { // eslint-disable-line no-unused-vars
204
     isVideo = !isVideo;
214
     isVideo = !isVideo;
205
     if (localTracks[1]) {
215
     if (localTracks[1]) {
222
         .catch(error => console.log(error));
232
         .catch(error => console.log(error));
223
 }
233
 }
224
 
234
 
235
+/**
236
+ *
237
+ * @param selected
238
+ */
225
 function changeAudioOutput(selected) { // eslint-disable-line no-unused-vars
239
 function changeAudioOutput(selected) { // eslint-disable-line no-unused-vars
226
     JitsiMeetJS.mediaDevices.setAudioOutputDevice(selected.value);
240
     JitsiMeetJS.mediaDevices.setAudioOutputDevice(selected.value);
227
 }
241
 }

+ 5
- 1
modules/DTMF/JitsiDTMFManager.js 查看文件

1
 const logger = require('jitsi-meet-logger').getLogger(__filename);
1
 const logger = require('jitsi-meet-logger').getLogger(__filename);
2
 
2
 
3
+/**
4
+ *
5
+ * @param localAudio
6
+ * @param peerConnection
7
+ */
3
 function JitsiDTMFManager(localAudio, peerConnection) {
8
 function JitsiDTMFManager(localAudio, peerConnection) {
4
     const audioTrack = localAudio.getTrack();
9
     const audioTrack = localAudio.getTrack();
5
 
10
 
11
     logger.debug('Initialized DTMFSender');
16
     logger.debug('Initialized DTMFSender');
12
 }
17
 }
13
 
18
 
14
-
15
 JitsiDTMFManager.prototype.sendTones = function(tones, duration, pause) {
19
 JitsiDTMFManager.prototype.sendTones = function(tones, duration, pause) {
16
     this.dtmfSender.insertDTMF(tones, duration || 200, pause || 200);
20
     this.dtmfSender.insertDTMF(tones, duration || 200, pause || 200);
17
 };
21
 };

+ 58
- 0
modules/RTC/RTC.js 查看文件

15
 
15
 
16
 const logger = getLogger(__filename);
16
 const logger = getLogger(__filename);
17
 
17
 
18
+/**
19
+ *
20
+ * @param tracksInfo
21
+ * @param options
22
+ */
18
 function createLocalTracks(tracksInfo, options) {
23
 function createLocalTracks(tracksInfo, options) {
19
     const newTracks = [];
24
     const newTracks = [];
20
     let deviceId = null;
25
     let deviceId = null;
41
     return newTracks;
46
     return newTracks;
42
 }
47
 }
43
 
48
 
49
+/**
50
+ *
51
+ */
44
 export default class RTC extends Listenable {
52
 export default class RTC extends Listenable {
53
+    /**
54
+     *
55
+     * @param conference
56
+     * @param options
57
+     */
45
     constructor(conference, options = {}) {
58
     constructor(conference, options = {}) {
46
         super();
59
         super();
47
         this.conference = conference;
60
         this.conference = conference;
198
         }
211
         }
199
     }
212
     }
200
 
213
 
214
+    /**
215
+     *
216
+     * @param eventType
217
+     * @param listener
218
+     */
201
     static addListener(eventType, listener) {
219
     static addListener(eventType, listener) {
202
         RTCUtils.addListener(eventType, listener);
220
         RTCUtils.addListener(eventType, listener);
203
     }
221
     }
204
 
222
 
223
+    /**
224
+     *
225
+     * @param eventType
226
+     * @param listener
227
+     */
205
     static removeListener(eventType, listener) {
228
     static removeListener(eventType, listener) {
206
         RTCUtils.removeListener(eventType, listener);
229
         RTCUtils.removeListener(eventType, listener);
207
     }
230
     }
208
 
231
 
232
+    /**
233
+     *
234
+     */
209
     static isRTCReady() {
235
     static isRTCReady() {
210
         return RTCUtils.isRTCReady();
236
         return RTCUtils.isRTCReady();
211
     }
237
     }
212
 
238
 
239
+    /**
240
+     *
241
+     * @param options
242
+     */
213
     static init(options = {}) {
243
     static init(options = {}) {
214
         this.options = options;
244
         this.options = options;
215
 
245
 
216
         return RTCUtils.init(this.options);
246
         return RTCUtils.init(this.options);
217
     }
247
     }
218
 
248
 
249
+    /**
250
+     *
251
+     */
219
     static getDeviceAvailability() {
252
     static getDeviceAvailability() {
220
         return RTCUtils.getDeviceAvailability();
253
         return RTCUtils.getDeviceAvailability();
221
     }
254
     }
269
 
302
 
270
     }
303
     }
271
 
304
 
305
+    /**
306
+     *
307
+     * @param track
308
+     */
272
     addLocalTrack(track) {
309
     addLocalTrack(track) {
273
         if (!track) {
310
         if (!track) {
274
             throw new Error('track must not be null nor undefined');
311
             throw new Error('track must not be null nor undefined');
401
         return Promise.all(mutePromises);
438
         return Promise.all(mutePromises);
402
     }
439
     }
403
 
440
 
441
+    /**
442
+     *
443
+     * @param track
444
+     */
404
     removeLocalTrack(track) {
445
     removeLocalTrack(track) {
405
         const pos = this.localTracks.indexOf(track);
446
         const pos = this.localTracks.indexOf(track);
406
 
447
 
546
         return toBeRemoved;
587
         return toBeRemoved;
547
     }
588
     }
548
 
589
 
590
+    /**
591
+     *
592
+     */
549
     static getPCConstraints() {
593
     static getPCConstraints() {
550
         return RTCUtils.pcConstraints;
594
         return RTCUtils.pcConstraints;
551
     }
595
     }
552
 
596
 
597
+    /**
598
+     *
599
+     * @param elSelector
600
+     * @param stream
601
+     */
553
     static attachMediaStream(elSelector, stream) {
602
     static attachMediaStream(elSelector, stream) {
554
         return RTCUtils.attachMediaStream(elSelector, stream);
603
         return RTCUtils.attachMediaStream(elSelector, stream);
555
     }
604
     }
556
 
605
 
606
+    /**
607
+     *
608
+     * @param stream
609
+     */
557
     static getStreamID(stream) {
610
     static getStreamID(stream) {
558
         return RTCUtils.getStreamID(stream);
611
         return RTCUtils.getStreamID(stream);
559
     }
612
     }
682
         }
735
         }
683
     }
736
     }
684
 
737
 
738
+    /**
739
+     *
740
+     * @param resource
741
+     * @param audioLevel
742
+     */
685
     setAudioLevel(resource, audioLevel) {
743
     setAudioLevel(resource, audioLevel) {
686
         if (!resource) {
744
         if (!resource) {
687
             return;
745
             return;

+ 25
- 2
modules/RTC/RTCBrowserType.js 查看文件

197
     // Add version getters for other browsers when needed
197
     // Add version getters for other browsers when needed
198
 };
198
 };
199
 
199
 
200
-// detectOpera() must be called before detectChrome() !!!
201
-// otherwise Opera wil be detected as Chrome
200
+/**
201
+ * detectOpera() must be called before detectChrome() !!!
202
+ * otherwise Opera wil be detected as Chrome
203
+ */
202
 function detectChrome() {
204
 function detectChrome() {
203
     if (navigator.webkitGetUserMedia) {
205
     if (navigator.webkitGetUserMedia) {
204
         currentBrowser = RTCBrowserType.RTC_BROWSER_CHROME;
206
         currentBrowser = RTCBrowserType.RTC_BROWSER_CHROME;
216
     return null;
218
     return null;
217
 }
219
 }
218
 
220
 
221
+/**
222
+ *
223
+ */
219
 function detectOpera() {
224
 function detectOpera() {
220
     const userAgent = navigator.userAgent;
225
     const userAgent = navigator.userAgent;
221
 
226
 
231
     return null;
236
     return null;
232
 }
237
 }
233
 
238
 
239
+/**
240
+ *
241
+ */
234
 function detectFirefox() {
242
 function detectFirefox() {
235
     if (navigator.mozGetUserMedia) {
243
     if (navigator.mozGetUserMedia) {
236
         currentBrowser = RTCBrowserType.RTC_BROWSER_FIREFOX;
244
         currentBrowser = RTCBrowserType.RTC_BROWSER_FIREFOX;
245
     return null;
253
     return null;
246
 }
254
 }
247
 
255
 
256
+/**
257
+ *
258
+ */
248
 function detectSafari() {
259
 function detectSafari() {
249
     if (/^((?!chrome).)*safari/i.test(navigator.userAgent)) {
260
     if (/^((?!chrome).)*safari/i.test(navigator.userAgent)) {
250
         currentBrowser = RTCBrowserType.RTC_BROWSER_SAFARI;
261
         currentBrowser = RTCBrowserType.RTC_BROWSER_SAFARI;
257
     return null;
268
     return null;
258
 }
269
 }
259
 
270
 
271
+/**
272
+ *
273
+ */
260
 function detectIE() {
274
 function detectIE() {
261
     let version;
275
     let version;
262
     const ua = window.navigator.userAgent;
276
     const ua = window.navigator.userAgent;
310
     return null;
324
     return null;
311
 }
325
 }
312
 
326
 
327
+/**
328
+ *
329
+ */
313
 function detectNWJS() {
330
 function detectNWJS() {
314
     const userAgent = navigator.userAgent;
331
     const userAgent = navigator.userAgent;
315
 
332
 
325
     return null;
342
     return null;
326
 }
343
 }
327
 
344
 
345
+/**
346
+ *
347
+ */
328
 function detectReactNative() {
348
 function detectReactNative() {
329
     const match
349
     const match
330
         = navigator.userAgent.match(/\b(react[ \t_-]*native)(?:\/(\S+))?/i);
350
         = navigator.userAgent.match(/\b(react[ \t_-]*native)(?:\/(\S+))?/i);
353
     return version;
373
     return version;
354
 }
374
 }
355
 
375
 
376
+/**
377
+ *
378
+ */
356
 function detectBrowser() {
379
 function detectBrowser() {
357
     let version;
380
     let version;
358
     const detectors = [
381
     const detectors = [

+ 43
- 6
modules/RTC/RTCUtils.js 查看文件

62
 
62
 
63
 let currentlyAvailableMediaDevices;
63
 let currentlyAvailableMediaDevices;
64
 
64
 
65
-let rawEnumerateDevicesWithCallback;
66
-
67
 /**
65
 /**
68
  * "rawEnumerateDevicesWithCallback" will be initialized only after WebRTC is
66
  * "rawEnumerateDevicesWithCallback" will be initialized only after WebRTC is
69
  * ready. Otherwise it is too early to assume that the devices listing is not
67
  * ready. Otherwise it is too early to assume that the devices listing is not
70
  * supported.
68
  * supported.
71
  */
69
  */
70
+let rawEnumerateDevicesWithCallback;
72
 
71
 
72
+/**
73
+ *
74
+ */
73
 function initRawEnumerateDevicesWithCallback() {
75
 function initRawEnumerateDevicesWithCallback() {
74
     rawEnumerateDevicesWithCallback = navigator.mediaDevices
76
     rawEnumerateDevicesWithCallback = navigator.mediaDevices
75
         && navigator.mediaDevices.enumerateDevices
77
         && navigator.mediaDevices.enumerateDevices
105
 
107
 
106
 let rtcReady = false;
108
 let rtcReady = false;
107
 
109
 
110
+/**
111
+ *
112
+ * @param constraints
113
+ * @param resolution
114
+ */
108
 function setResolutionConstraints(constraints, resolution) {
115
 function setResolutionConstraints(constraints, resolution) {
109
     const isAndroid = RTCBrowserType.isAndroid();
116
     const isAndroid = RTCBrowserType.isAndroid();
110
 
117
 
358
                 .sort()
365
                 .sort()
359
                 .join(''));
366
                 .join(''));
360
 
367
 
368
+    /**
369
+     *
370
+     * @param info
371
+     */
361
     function mediaDeviceInfoToJSON(info) {
372
     function mediaDeviceInfoToJSON(info) {
362
         return JSON.stringify({
373
         return JSON.stringify({
363
             kind: info.kind,
374
             kind: info.kind,
664
     element.src = src || '';
675
     element.src = src || '';
665
 }
676
 }
666
 
677
 
667
-// Options parameter is to pass config options. Currently uses only "useIPv6".
678
+/**
679
+ *
680
+ */
668
 class RTCUtils extends Listenable {
681
 class RTCUtils extends Listenable {
682
+    /**
683
+     *
684
+     */
669
     constructor() {
685
     constructor() {
670
         super(eventEmitter);
686
         super(eventEmitter);
671
     }
687
     }
672
 
688
 
689
+    /**
690
+     *
691
+     * @param options
692
+     */
673
     init(options) {
693
     init(options) {
674
         if (typeof options.disableAEC === 'boolean') {
694
         if (typeof options.disableAEC === 'boolean') {
675
             disableAEC = options.disableAEC;
695
             disableAEC = options.disableAEC;
1119
         });
1139
         });
1120
     }
1140
     }
1121
 
1141
 
1142
+    /**
1143
+     *
1144
+     */
1122
     getDeviceAvailability() {
1145
     getDeviceAvailability() {
1123
         return devices;
1146
         return devices;
1124
     }
1147
     }
1125
 
1148
 
1149
+    /**
1150
+     *
1151
+     */
1126
     isRTCReady() {
1152
     isRTCReady() {
1127
         return rtcReady;
1153
         return rtcReady;
1128
     }
1154
     }
1129
 
1155
 
1156
+    /**
1157
+     *
1158
+     */
1130
     _isDeviceListAvailable() {
1159
     _isDeviceListAvailable() {
1131
         if (!rtcReady) {
1160
         if (!rtcReady) {
1132
             throw new Error('WebRTC not ready yet');
1161
             throw new Error('WebRTC not ready yet');
1327
 
1356
 
1328
 const rtcUtils = new RTCUtils();
1357
 const rtcUtils = new RTCUtils();
1329
 
1358
 
1359
+/**
1360
+ *
1361
+ * @param options
1362
+ */
1330
 function obtainDevices(options) {
1363
 function obtainDevices(options) {
1331
     if (!options.devices || options.devices.length === 0) {
1364
     if (!options.devices || options.devices.length === 0) {
1332
         return options.successCallback(options.streams || {});
1365
         return options.successCallback(options.streams || {});
1350
         });
1383
         });
1351
 }
1384
 }
1352
 
1385
 
1353
-// In case of IE we continue from 'onReady' callback
1354
-// passed to RTCUtils constructor. It will be invoked by Temasys plugin
1355
-// once it is initialized.
1386
+/**
1387
+ * In case of IE we continue from 'onReady' callback passed to RTCUtils
1388
+ * constructor. It will be invoked by Temasys plugin once it is initialized.
1389
+ *
1390
+ * @param options
1391
+ * @param GUM
1392
+ */
1356
 function onReady(options, GUM) {
1393
 function onReady(options, GUM) {
1357
     rtcReady = true;
1394
     rtcReady = true;
1358
     eventEmitter.emit(RTCEvents.RTC_READY, true);
1395
     eventEmitter.emit(RTCEvents.RTC_READY, true);

+ 15
- 0
modules/RTC/ScreenObtainer.js 查看文件

406
     }
406
     }
407
 }
407
 }
408
 
408
 
409
+/**
410
+ *
411
+ * @param callback
412
+ * @param options
413
+ */
409
 function checkChromeExtInstalled(callback, options) {
414
 function checkChromeExtInstalled(callback, options) {
410
     if (typeof chrome === 'undefined' || !chrome || !chrome.runtime) {
415
     if (typeof chrome === 'undefined' || !chrome || !chrome.runtime) {
411
         // No API, so no extension for sure
416
         // No API, so no extension for sure
440
     );
445
     );
441
 }
446
 }
442
 
447
 
448
+/**
449
+ *
450
+ * @param options
451
+ * @param streamCallback
452
+ * @param failCallback
453
+ */
443
 function doGetStreamFromExtension(options, streamCallback, failCallback) {
454
 function doGetStreamFromExtension(options, streamCallback, failCallback) {
444
     // Sends 'getStream' msg to the extension.
455
     // Sends 'getStream' msg to the extension.
445
     // Extension id must be defined in the config.
456
     // Extension id must be defined in the config.
482
         getWebStoreInstallUrl(options));
493
         getWebStoreInstallUrl(options));
483
 }
494
 }
484
 
495
 
496
+/**
497
+ *
498
+ * @param options
499
+ */
485
 function initChromeExtension(options) {
500
 function initChromeExtension(options) {
486
     // Initialize Chrome extension inline installs
501
     // Initialize Chrome extension inline installs
487
     initInlineInstalls(options);
502
     initInlineInstalls(options);

+ 3
- 0
modules/TalkMutedDetection.js 查看文件

1
 import * as JitsiConferenceEvents from '../JitsiConferenceEvents';
1
 import * as JitsiConferenceEvents from '../JitsiConferenceEvents';
2
 
2
 
3
+/**
4
+ *
5
+ */
3
 export default class TalkMutedDetection {
6
 export default class TalkMutedDetection {
4
     /**
7
     /**
5
      * Creates TalkMutedDetection
8
      * Creates TalkMutedDetection

+ 6
- 0
modules/connectivity/ConnectionQuality.js 查看文件

145
  * value of 0% indicates a poor connection.
145
  * value of 0% indicates a poor connection.
146
  */
146
  */
147
 export default class ConnectionQuality {
147
 export default class ConnectionQuality {
148
+    /**
149
+     *
150
+     * @param conference
151
+     * @param eventEmitter
152
+     * @param options
153
+     */
148
     constructor(conference, eventEmitter, options) {
154
     constructor(conference, eventEmitter, options) {
149
         this.eventEmitter = eventEmitter;
155
         this.eventEmitter = eventEmitter;
150
 
156
 

+ 5
- 0
modules/connectivity/ParticipantConnectionStatus.js 查看文件

189
         }
189
         }
190
     }
190
     }
191
 
191
 
192
+    /**
193
+     *
194
+     * @param participant
195
+     * @param newStatus
196
+     */
192
     _changeConnectionStatus(participant, newStatus) {
197
     _changeConnectionStatus(participant, newStatus) {
193
         if (participant.isConnectionActive() !== newStatus) {
198
         if (participant.isConnectionActive() !== newStatus) {
194
 
199
 

+ 12
- 0
modules/settings/Settings.js 查看文件

17
     return global.localStorage;
17
     return global.localStorage;
18
 }
18
 }
19
 
19
 
20
+/**
21
+ *
22
+ */
20
 function _p8() {
23
 function _p8() {
21
     return `${Math.random().toString(16)}000000000`.substr(2, 8);
24
     return `${Math.random().toString(16)}000000000`.substr(2, 8);
22
 }
25
 }
23
 
26
 
27
+/**
28
+ *
29
+ */
24
 function generateUniqueId() {
30
 function generateUniqueId() {
25
     return _p8() + _p8() + _p8() + _p8();
31
     return _p8() + _p8() + _p8() + _p8();
26
 }
32
 }
49
     return username;
55
     return username;
50
 }
56
 }
51
 
57
 
58
+/**
59
+ *
60
+ */
52
 class Settings {
61
 class Settings {
62
+    /**
63
+     *
64
+     */
53
     constructor() {
65
     constructor() {
54
         const localStorage = getLocalStorage();
66
         const localStorage = getLocalStorage();
55
 
67
 

+ 9
- 0
modules/statistics/AnalyticsAdapter.js 查看文件

2
  * Interface for analytics handlers.
2
  * Interface for analytics handlers.
3
  */
3
  */
4
 class AnalyticsAbstract {
4
 class AnalyticsAbstract {
5
+    /**
6
+     *
7
+     */
5
     sendEvent() {} // eslint-disable-line no-empty-function
8
     sendEvent() {} // eslint-disable-line no-empty-function
6
 }
9
 }
7
 
10
 
10
  * @extends AnalyticsAbstract
13
  * @extends AnalyticsAbstract
11
  */
14
  */
12
 class CacheAnalytics extends AnalyticsAbstract {
15
 class CacheAnalytics extends AnalyticsAbstract {
16
+    /**
17
+     *
18
+     */
13
     constructor() {
19
     constructor() {
14
         super();
20
         super();
15
 
21
 
50
  * This class will store and manage the handlers that are going to be used.
56
  * This class will store and manage the handlers that are going to be used.
51
  */
57
  */
52
 class AnalyticsAdapter {
58
 class AnalyticsAdapter {
59
+    /**
60
+     *
61
+     */
53
     constructor() {
62
     constructor() {
54
         this.analyticsHandlers = new Set();
63
         this.analyticsHandlers = new Set();
55
 
64
 

+ 6
- 0
modules/statistics/CallStats.js 查看文件

486
 };
486
 };
487
 
487
 
488
 /* eslint-disable no-invalid-this */
488
 /* eslint-disable no-invalid-this */
489
+
490
+/**
491
+ *
492
+ * @param err
493
+ * @param msg
494
+ */
489
 function initCallback(err, msg) {
495
 function initCallback(err, msg) {
490
     logger.log(`CallStats Status: err=${err} msg=${msg}`);
496
     logger.log(`CallStats Status: err=${err} msg=${msg}`);
491
 
497
 

+ 8
- 0
modules/statistics/RTPStatsCollector.js 查看文件

122
     this.bitrate.upload = 0;
122
     this.bitrate.upload = 0;
123
 };
123
 };
124
 
124
 
125
+/**
126
+ *
127
+ */
125
 function ConferenceStats() {
128
 function ConferenceStats() {
126
 
129
 
127
     /**
130
     /**
402
 
405
 
403
     const getStatValue = this._getStatValue;
406
     const getStatValue = this._getStatValue;
404
 
407
 
408
+    /**
409
+     *
410
+     * @param report
411
+     * @param name
412
+     */
405
     function getNonNegativeStat(report, name) {
413
     function getNonNegativeStat(report, name) {
406
         let value = getStatValue(report, name);
414
         let value = getStatValue(report, name);
407
 
415
 

+ 16
- 7
modules/statistics/statistics.js 查看文件

16
  */
16
  */
17
 let isCallstatsLoaded = false;
17
 let isCallstatsLoaded = false;
18
 
18
 
19
-// Since callstats.io is a third party, we cannot guarantee the quality of their
20
-// service. More specifically, their server may take noticeably long time to
21
-// respond. Consequently, it is in our best interest (in the sense that the
22
-// intergration of callstats.io is pretty important to us but not enough to
23
-// allow it to prevent people from joining a conference) to (1) start
24
-// downloading their API as soon as possible and (2) do the downloading
25
-// asynchronously.
19
+/**
20
+ * Since callstats.io is a third party, we cannot guarantee the quality of their
21
+ * service. More specifically, their server may take noticeably long time to
22
+ * respond. Consequently, it is in our best interest (in the sense that the
23
+ * intergration of callstats.io is pretty important to us but not enough to
24
+ * allow it to prevent people from joining a conference) to (1) start
25
+ * downloading their API as soon as possible and (2) do the downloading
26
+ * asynchronously.
27
+ *
28
+ * @param customScriptUrl
29
+ */
26
 function loadCallStatsAPI(customScriptUrl) {
30
 function loadCallStatsAPI(customScriptUrl) {
27
     if (!isCallstatsLoaded) {
31
     if (!isCallstatsLoaded) {
28
         ScriptUtil.loadScript(
32
         ScriptUtil.loadScript(
81
 
85
 
82
 };
86
 };
83
 
87
 
88
+/**
89
+ *
90
+ * @param xmpp
91
+ * @param options
92
+ */
84
 function Statistics(xmpp, options) {
93
 function Statistics(xmpp, options) {
85
     this.rtpStats = null;
94
     this.rtpStats = null;
86
     this.eventEmitter = new EventEmitter();
95
     this.eventEmitter = new EventEmitter();

+ 5
- 0
modules/xmpp/Caps.js 查看文件

9
 const IDENTITY_PROPERTIES_FOR_COMPARE = [ 'category', 'type', 'lang' ];
9
 const IDENTITY_PROPERTIES_FOR_COMPARE = [ 'category', 'type', 'lang' ];
10
 const HASH = 'sha-1';
10
 const HASH = 'sha-1';
11
 
11
 
12
+/**
13
+ *
14
+ * @param a
15
+ * @param b
16
+ */
12
 function compareIdentities(a, b) {
17
 function compareIdentities(a, b) {
13
     let res = 0;
18
     let res = 0;
14
 
19
 

+ 136
- 1
modules/xmpp/ChatRoom.js 查看文件

83
 // of chaining function calls, allow long function call chains.
83
 // of chaining function calls, allow long function call chains.
84
 /* eslint-disable newline-per-chained-call */
84
 /* eslint-disable newline-per-chained-call */
85
 
85
 
86
+/**
87
+ *
88
+ */
86
 export default class ChatRoom extends Listenable {
89
 export default class ChatRoom extends Listenable {
87
 
90
 
88
     /* eslint-disable max-params */
91
     /* eslint-disable max-params */
89
 
92
 
93
+    /**
94
+     *
95
+     * @param connection
96
+     * @param jid
97
+     * @param password
98
+     * @param XMPP
99
+     * @param options
100
+     */
90
     constructor(connection, jid, password, XMPP, options) {
101
     constructor(connection, jid, password, XMPP, options) {
91
         super();
102
         super();
92
         this.xmpp = XMPP;
103
         this.xmpp = XMPP;
120
 
131
 
121
     /* eslint-enable max-params */
132
     /* eslint-enable max-params */
122
 
133
 
134
+    /**
135
+     *
136
+     */
123
     initPresenceMap() {
137
     initPresenceMap() {
124
         this.presMap.to = this.myroomjid;
138
         this.presMap.to = this.myroomjid;
125
         this.presMap.xns = 'http://jabber.org/protocol/muc';
139
         this.presMap.xns = 'http://jabber.org/protocol/muc';
136
         this.addVideoInfoToPresence(false);
150
         this.addVideoInfoToPresence(false);
137
     }
151
     }
138
 
152
 
153
+    /**
154
+     *
155
+     * @param devices
156
+     */
139
     updateDeviceAvailability(devices) {
157
     updateDeviceAvailability(devices) {
140
         this.presMap.nodes.push({
158
         this.presMap.nodes.push({
141
             'tagName': 'devices',
159
             'tagName': 'devices',
152
         });
170
         });
153
     }
171
     }
154
 
172
 
173
+    /**
174
+     *
175
+     * @param password
176
+     */
155
     join(password) {
177
     join(password) {
156
         this.password = password;
178
         this.password = password;
157
         this.moderator.allocateConferenceFocus(() => this.sendPresence(true));
179
         this.moderator.allocateConferenceFocus(() => this.sendPresence(true));
158
     }
180
     }
159
 
181
 
182
+    /**
183
+     *
184
+     * @param fromJoin
185
+     */
160
     sendPresence(fromJoin) {
186
     sendPresence(fromJoin) {
161
         const to = this.presMap.to;
187
         const to = this.presMap.to;
162
 
188
 
220
         this.connection.flush();
246
         this.connection.flush();
221
     }
247
     }
222
 
248
 
249
+    /**
250
+     *
251
+     */
223
     discoRoomInfo() {
252
     discoRoomInfo() {
224
       // https://xmpp.org/extensions/xep-0045.html#disco-roominfo
253
       // https://xmpp.org/extensions/xep-0045.html#disco-roominfo
225
 
254
 
243
         });
272
         });
244
     }
273
     }
245
 
274
 
246
-
275
+    /**
276
+     *
277
+     */
247
     createNonAnonymousRoom() {
278
     createNonAnonymousRoom() {
248
         // http://xmpp.org/extensions/xep-0045.html#createroom-reserved
279
         // http://xmpp.org/extensions/xep-0045.html#createroom-reserved
249
 
280
 
289
         });
320
         });
290
     }
321
     }
291
 
322
 
323
+    /**
324
+     *
325
+     * @param pres
326
+     */
292
     onPresence(pres) {
327
     onPresence(pres) {
293
         const from = pres.getAttribute('from');
328
         const from = pres.getAttribute('from');
294
 
329
 
490
         this.participantPropertyListener = listener;
525
         this.participantPropertyListener = listener;
491
     }
526
     }
492
 
527
 
528
+    /**
529
+     *
530
+     * @param node
531
+     * @param from
532
+     */
493
     processNode(node, from) {
533
     processNode(node, from) {
494
         // make sure we catch all errors coming from any handler
534
         // make sure we catch all errors coming from any handler
495
         // otherwise we can remove the presence handler from strophe
535
         // otherwise we can remove the presence handler from strophe
509
         }
549
         }
510
     }
550
     }
511
 
551
 
552
+    /**
553
+     *
554
+     * @param body
555
+     * @param nickname
556
+     */
512
     sendMessage(body, nickname) {
557
     sendMessage(body, nickname) {
513
         const msg = $msg({ to: this.roomjid,
558
         const msg = $msg({ to: this.roomjid,
514
             type: 'groupchat' });
559
             type: 'groupchat' });
524
         this.eventEmitter.emit(XMPPEvents.SENDING_CHAT_MESSAGE, body);
569
         this.eventEmitter.emit(XMPPEvents.SENDING_CHAT_MESSAGE, body);
525
     }
570
     }
526
 
571
 
572
+    /**
573
+     *
574
+     * @param subject
575
+     */
527
     setSubject(subject) {
576
     setSubject(subject) {
528
         const msg = $msg({ to: this.roomjid,
577
         const msg = $msg({ to: this.roomjid,
529
             type: 'groupchat' });
578
             type: 'groupchat' });
551
         this.moderator.onMucMemberLeft(jid);
600
         this.moderator.onMucMemberLeft(jid);
552
     }
601
     }
553
 
602
 
603
+    /**
604
+     *
605
+     * @param pres
606
+     * @param from
607
+     */
554
     onPresenceUnavailable(pres, from) {
608
     onPresenceUnavailable(pres, from) {
555
         // room destroyed ?
609
         // room destroyed ?
556
         if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]'
610
         if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]'
617
         }
671
         }
618
     }
672
     }
619
 
673
 
674
+    /**
675
+     *
676
+     * @param msg
677
+     * @param from
678
+     */
620
     onMessage(msg, from) {
679
     onMessage(msg, from) {
621
         const nick
680
         const nick
622
             = $(msg).find('>nick[xmlns="http://jabber.org/protocol/nick"]')
681
             = $(msg).find('>nick[xmlns="http://jabber.org/protocol/nick"]')
676
         }
735
         }
677
     }
736
     }
678
 
737
 
738
+    /**
739
+     *
740
+     * @param pres
741
+     * @param from
742
+     */
679
     onPresenceError(pres, from) {
743
     onPresenceError(pres, from) {
680
         if ($(pres)
744
         if ($(pres)
681
                 .find(
745
                 .find(
715
         }
779
         }
716
     }
780
     }
717
 
781
 
782
+    /**
783
+     *
784
+     * @param jid
785
+     */
718
     kick(jid) {
786
     kick(jid) {
719
         const kickIQ = $iq({ to: this.roomjid,
787
         const kickIQ = $iq({ to: this.roomjid,
720
             type: 'set' })
788
             type: 'set' })
731
 
799
 
732
     /* eslint-disable max-params */
800
     /* eslint-disable max-params */
733
 
801
 
802
+    /**
803
+     *
804
+     * @param key
805
+     * @param onSuccess
806
+     * @param onError
807
+     * @param onNotSupported
808
+     */
734
     lockRoom(key, onSuccess, onError, onNotSupported) {
809
     lockRoom(key, onSuccess, onError, onNotSupported) {
735
         // http://xmpp.org/extensions/xep-0045.html#roomconfig
810
         // http://xmpp.org/extensions/xep-0045.html#roomconfig
736
         this.connection.sendIQ(
811
         this.connection.sendIQ(
791
 
866
 
792
     /* eslint-enable max-params */
867
     /* eslint-enable max-params */
793
 
868
 
869
+    /**
870
+     *
871
+     * @param key
872
+     * @param values
873
+     */
794
     addToPresence(key, values) {
874
     addToPresence(key, values) {
795
         values.tagName = key;
875
         values.tagName = key;
796
         this.removeFromPresence(key);
876
         this.removeFromPresence(key);
797
         this.presMap.nodes.push(values);
877
         this.presMap.nodes.push(values);
798
     }
878
     }
799
 
879
 
880
+    /**
881
+     *
882
+     * @param key
883
+     */
800
     removeFromPresence(key) {
884
     removeFromPresence(key) {
801
         const nodes = this.presMap.nodes.filter(node => key !== node.tagName);
885
         const nodes = this.presMap.nodes.filter(node => key !== node.tagName);
802
 
886
 
803
         this.presMap.nodes = nodes;
887
         this.presMap.nodes = nodes;
804
     }
888
     }
805
 
889
 
890
+    /**
891
+     *
892
+     * @param name
893
+     * @param handler
894
+     */
806
     addPresenceListener(name, handler) {
895
     addPresenceListener(name, handler) {
807
         this.presHandlers[name] = handler;
896
         this.presHandlers[name] = handler;
808
     }
897
     }
809
 
898
 
899
+    /**
900
+     *
901
+     * @param name
902
+     */
810
     removePresenceListener(name) {
903
     removePresenceListener(name) {
811
         delete this.presHandlers[name];
904
         delete this.presHandlers[name];
812
     }
905
     }
829
         return null;
922
         return null;
830
     }
923
     }
831
 
924
 
925
+    /**
926
+     *
927
+     */
832
     isModerator() {
928
     isModerator() {
833
         return this.role === 'moderator';
929
         return this.role === 'moderator';
834
     }
930
     }
835
 
931
 
932
+    /**
933
+     *
934
+     * @param peerJid
935
+     */
836
     getMemberRole(peerJid) {
936
     getMemberRole(peerJid) {
837
         if (this.members[peerJid]) {
937
         if (this.members[peerJid]) {
838
             return this.members[peerJid].role;
938
             return this.members[peerJid].role;
841
         return null;
941
         return null;
842
     }
942
     }
843
 
943
 
944
+    /**
945
+     *
946
+     * @param mute
947
+     * @param callback
948
+     */
844
     setVideoMute(mute, callback) {
949
     setVideoMute(mute, callback) {
845
         this.sendVideoInfoPresence(mute);
950
         this.sendVideoInfoPresence(mute);
846
         if (callback) {
951
         if (callback) {
848
         }
953
         }
849
     }
954
     }
850
 
955
 
956
+    /**
957
+     *
958
+     * @param mute
959
+     * @apram callback
960
+     */
851
     setAudioMute(mute, callback) {
961
     setAudioMute(mute, callback) {
852
         return this.sendAudioInfoPresence(mute, callback);
962
         return this.sendAudioInfoPresence(mute, callback);
853
     }
963
     }
854
 
964
 
965
+    /**
966
+     *
967
+     * @param mute
968
+     */
855
     addAudioInfoToPresence(mute) {
969
     addAudioInfoToPresence(mute) {
856
         this.removeFromPresence('audiomuted');
970
         this.removeFromPresence('audiomuted');
857
         this.addToPresence('audiomuted',
971
         this.addToPresence('audiomuted',
860
                 value: mute.toString() });
974
                 value: mute.toString() });
861
     }
975
     }
862
 
976
 
977
+    /**
978
+     *
979
+     * @param mute
980
+     * @param callback
981
+     */
863
     sendAudioInfoPresence(mute, callback) {
982
     sendAudioInfoPresence(mute, callback) {
864
         this.addAudioInfoToPresence(mute);
983
         this.addAudioInfoToPresence(mute);
865
         if (this.connection) {
984
         if (this.connection) {
870
         }
989
         }
871
     }
990
     }
872
 
991
 
992
+    /**
993
+     *
994
+     * @param mute
995
+     */
873
     addVideoInfoToPresence(mute) {
996
     addVideoInfoToPresence(mute) {
874
         this.removeFromPresence('videomuted');
997
         this.removeFromPresence('videomuted');
875
         this.addToPresence('videomuted',
998
         this.addToPresence('videomuted',
878
                 value: mute.toString() });
1001
                 value: mute.toString() });
879
     }
1002
     }
880
 
1003
 
1004
+    /**
1005
+     *
1006
+     * @param mute
1007
+     */
881
     sendVideoInfoPresence(mute) {
1008
     sendVideoInfoPresence(mute) {
882
         this.addVideoInfoToPresence(mute);
1009
         this.addVideoInfoToPresence(mute);
883
         if (!this.connection) {
1010
         if (!this.connection) {
1037
             error => logger.log('set mute error', error));
1164
             error => logger.log('set mute error', error));
1038
     }
1165
     }
1039
 
1166
 
1167
+    /**
1168
+     *
1169
+     * @param iq
1170
+     */
1040
     onMute(iq) {
1171
     onMute(iq) {
1041
         const from = iq.getAttribute('from');
1172
         const from = iq.getAttribute('from');
1042
 
1173
 
1069
             const timeout = setTimeout(() => onMucLeft(true), 5000);
1200
             const timeout = setTimeout(() => onMucLeft(true), 5000);
1070
             const eventEmitter = this.eventEmitter;
1201
             const eventEmitter = this.eventEmitter;
1071
 
1202
 
1203
+            /**
1204
+             *
1205
+             * @param doReject
1206
+             */
1072
             function onMucLeft(doReject = false) {
1207
             function onMucLeft(doReject = false) {
1073
                 eventEmitter.removeListener(XMPPEvents.MUC_LEFT, onMucLeft);
1208
                 eventEmitter.removeListener(XMPPEvents.MUC_LEFT, onMucLeft);
1074
                 clearTimeout(timeout);
1209
                 clearTimeout(timeout);

+ 8
- 0
modules/xmpp/ConnectionPlugin.js 查看文件

10
      * Base class for strophe connection plugins.
10
      * Base class for strophe connection plugins.
11
      */
11
      */
12
     return class extends base {
12
     return class extends base {
13
+        /**
14
+         *
15
+         */
13
         constructor(...args) {
16
         constructor(...args) {
14
             super(...args);
17
             super(...args);
15
             this.connection = null;
18
             this.connection = null;
16
         }
19
         }
20
+
21
+        /**
22
+         *
23
+         * @param connection
24
+         */
17
         init(connection) {
25
         init(connection) {
18
             this.connection = connection;
26
             this.connection = connection;
19
         }
27
         }

+ 21
- 12
modules/xmpp/JingleSession.js 查看文件

4
 
4
 
5
 const logger = getLogger(__filename);
5
 const logger = getLogger(__filename);
6
 
6
 
7
-/*
7
+/**
8
  * JingleSession provides an API to manage a single Jingle session. We will
8
  * JingleSession provides an API to manage a single Jingle session. We will
9
  * have different implementations depending on the underlying interface used
9
  * have different implementations depending on the underlying interface used
10
  * (i.e. WebRTC and ORTC) and here we hold the code common to all of them.
10
  * (i.e. WebRTC and ORTC) and here we hold the code common to all of them.
99
      * {@link initialize}.
99
      * {@link initialize}.
100
      * @protected
100
      * @protected
101
      */
101
      */
102
-    doInitialize() { } // eslint-disable-line no-empty-function
102
+    doInitialize() {} // eslint-disable-line no-empty-function
103
+
104
+    /* eslint-disable no-unused-vars, no-empty-function */
103
 
105
 
104
     /**
106
     /**
105
      * Adds the ICE candidates found in the 'contents' array as remote
107
      * Adds the ICE candidates found in the 'contents' array as remote
106
      * candidates?
108
      * candidates?
107
      * Note: currently only used on transport-info
109
      * Note: currently only used on transport-info
110
+     *
111
+     * @param contents
108
      */
112
      */
109
-    // eslint-disable-next-line no-unused-vars, no-empty-function
110
-    addIceCandidates(contents) { }
113
+    addIceCandidates(contents) {}
114
+
115
+    /* eslint-enable no-unused-vars, no-empty-function */
111
 
116
 
112
     /**
117
     /**
113
      * Returns current state of this <tt>JingleSession</tt> instance.
118
      * Returns current state of this <tt>JingleSession</tt> instance.
117
         return this.state;
122
         return this.state;
118
     }
123
     }
119
 
124
 
125
+    /* eslint-disable no-unused-vars, no-empty-function */
126
+
120
     /**
127
     /**
121
      * Handles an 'add-source' event.
128
      * Handles an 'add-source' event.
122
      *
129
      *
123
      * @param contents an array of Jingle 'content' elements.
130
      * @param contents an array of Jingle 'content' elements.
124
      */
131
      */
125
-    // eslint-disable-next-line no-unused-vars, no-empty-function
126
-    addSources(contents) { }
132
+    addSources(contents) {}
127
 
133
 
128
     /**
134
     /**
129
      * Handles a 'remove-source' event.
135
      * Handles a 'remove-source' event.
130
      *
136
      *
131
      * @param contents an array of Jingle 'content' elements.
137
      * @param contents an array of Jingle 'content' elements.
132
      */
138
      */
133
-    // eslint-disable-next-line no-unused-vars, no-empty-function
134
-    removeSources(contents) { }
139
+    removeSources(contents) {}
140
+
141
+    /* eslint-disable max-params */
135
 
142
 
136
     /**
143
     /**
137
      * Terminates this Jingle session by sending session-terminate
144
      * Terminates this Jingle session by sending session-terminate
142
      * @param failure a callback called when either timeout occurs or ERROR
149
      * @param failure a callback called when either timeout occurs or ERROR
143
      * response is received.
150
      * response is received.
144
      */
151
      */
145
-    // eslint-disable-next-line max-params, no-unused-vars, no-empty-function
146
-    terminate(reason, text, success, failure) { }
152
+    terminate(reason, text, success, failure) {}
153
+
154
+    /* eslint-enable max-params */
147
 
155
 
148
     /**
156
     /**
149
      * Handles an offer from the remote peer (prepares to accept a session).
157
      * Handles an offer from the remote peer (prepares to accept a session).
154
      * error object with details(which is meant more to be printed to the logger
162
      * error object with details(which is meant more to be printed to the logger
155
      * than analysed in the code, as the error is unrecoverable anyway)
163
      * than analysed in the code, as the error is unrecoverable anyway)
156
      */
164
      */
157
-    // eslint-disable-next-line no-unused-vars, no-empty-function
158
-    acceptOffer(jingle, success, failure) { }
165
+    acceptOffer(jingle, success, failure) {}
166
+
167
+    /* eslint-enable no-unused-vars, no-empty-function */
159
 }
168
 }

+ 28
- 0
modules/xmpp/JingleSessionPC.js 查看文件

22
  */
22
  */
23
 const IQ_TIMEOUT = 10000;
23
 const IQ_TIMEOUT = 10000;
24
 
24
 
25
+/**
26
+ *
27
+ */
25
 export default class JingleSessionPC extends JingleSession {
28
 export default class JingleSessionPC extends JingleSession {
26
 
29
 
27
     /* eslint-disable max-params */
30
     /* eslint-disable max-params */
108
 
111
 
109
     /* eslint-enable max-params */
112
     /* eslint-enable max-params */
110
 
113
 
114
+    /**
115
+     *
116
+     */
111
     doInitialize() {
117
     doInitialize() {
112
         this.lasticecandidate = false;
118
         this.lasticecandidate = false;
113
 
119
 
244
         };
250
         };
245
     }
251
     }
246
 
252
 
253
+    /**
254
+     *
255
+     * @param candidate
256
+     */
247
     sendIceCandidate(candidate) {
257
     sendIceCandidate(candidate) {
248
         const localSDP = new SDP(this.peerconnection.localDescription.sdp);
258
         const localSDP = new SDP(this.peerconnection.localDescription.sdp);
249
 
259
 
286
         }
296
         }
287
     }
297
     }
288
 
298
 
299
+    /**
300
+     *
301
+     * @param candidates
302
+     */
289
     sendIceCandidates(candidates) {
303
     sendIceCandidates(candidates) {
290
         logger.log('sendIceCandidates', candidates);
304
         logger.log('sendIceCandidates', candidates);
291
         const cand = $iq({ to: this.peerjid,
305
         const cand = $iq({ to: this.peerjid,
357
             }), IQ_TIMEOUT);
371
             }), IQ_TIMEOUT);
358
     }
372
     }
359
 
373
 
374
+    /**
375
+     *
376
+     * @param contents
377
+     */
360
     readSsrcInfo(contents) {
378
     readSsrcInfo(contents) {
361
         $(contents).each((i1, content) => {
379
         $(contents).each((i1, content) => {
362
             const ssrcs
380
             const ssrcs
672
 
690
 
673
     /* eslint-enable max-params */
691
     /* eslint-enable max-params */
674
 
692
 
693
+    /**
694
+     *
695
+     * @param reasonCondition
696
+     * @param reasonText
697
+     */
675
     onTerminated(reasonCondition, reasonText) {
698
     onTerminated(reasonCondition, reasonText) {
676
         this.state = 'ended';
699
         this.state = 'ended';
677
 
700
 
1492
         };
1515
         };
1493
     }
1516
     }
1494
 
1517
 
1518
+    /**
1519
+     *
1520
+     * @param session
1521
+     * @param error
1522
+     */
1495
     static onJingleFatalError(session, error) {
1523
     static onJingleFatalError(session, error) {
1496
         if (this.room) {
1524
         if (this.room) {
1497
             this.room.eventEmitter.emit(
1525
             this.room.eventEmitter.emit(

+ 4
- 1
modules/xmpp/SDP.js 查看文件

2
 
2
 
3
 const SDPUtil = require('./SDPUtil');
3
 const SDPUtil = require('./SDPUtil');
4
 
4
 
5
-// SDP STUFF
5
+/**
6
+ *
7
+ * @param sdp
8
+ */
6
 function SDP(sdp) {
9
 function SDP(sdp) {
7
     const media = sdp.split('\r\nm=');
10
     const media = sdp.split('\r\nm=');
8
 
11
 

+ 10
- 0
modules/xmpp/SDPDiffer.js 查看文件

1
 const SDPUtil = require('./SDPUtil');
1
 const SDPUtil = require('./SDPUtil');
2
 
2
 
3
 // this could be useful in Array.prototype.
3
 // this could be useful in Array.prototype.
4
+/**
5
+ *
6
+ * @param array1
7
+ * @param array2
8
+ */
4
 function arrayEquals(array1, array2) {
9
 function arrayEquals(array1, array2) {
5
     // if the other array is a falsy value, return
10
     // if the other array is a falsy value, return
6
     if (!array2) {
11
     if (!array2) {
29
     return true;
34
     return true;
30
 }
35
 }
31
 
36
 
37
+/**
38
+ *
39
+ * @param mySDP
40
+ * @param otherSDP
41
+ */
32
 function SDPDiffer(mySDP, otherSDP) {
42
 function SDPDiffer(mySDP, otherSDP) {
33
     this.mySDP = mySDP;
43
     this.mySDP = mySDP;
34
     this.otherSDP = otherSDP;
44
     this.otherSDP = otherSDP;

+ 3
- 0
modules/xmpp/SdpTransformUtil.js 查看文件

53
         this.mLine = mLine;
53
         this.mLine = mLine;
54
     }
54
     }
55
 
55
 
56
+    /**
57
+     *
58
+     */
56
     get _ssrcs() {
59
     get _ssrcs() {
57
         if (!this.mLine.ssrcs) {
60
         if (!this.mLine.ssrcs) {
58
             this.mLine.ssrcs = [];
61
             this.mLine.ssrcs = [];

+ 16
- 2
modules/xmpp/moderator.js 查看文件

8
 
8
 
9
 import Settings from '../settings/Settings';
9
 import Settings from '../settings/Settings';
10
 
10
 
11
+/**
12
+ *
13
+ * @param step
14
+ */
11
 function createExpBackoffTimer(step) {
15
 function createExpBackoffTimer(step) {
12
     let count = 1;
16
     let count = 1;
13
 
17
 
30
 
34
 
31
 /* eslint-disable max-params */
35
 /* eslint-disable max-params */
32
 
36
 
37
+/**
38
+ *
39
+ * @param roomName
40
+ * @param xmpp
41
+ * @param emitter
42
+ * @param options
43
+ */
33
 function Moderator(roomName, xmpp, emitter, options) {
44
 function Moderator(roomName, xmpp, emitter, options) {
34
     this.roomName = roomName;
45
     this.roomName = roomName;
35
     this.xmppService = xmpp;
46
     this.xmppService = xmpp;
51
 
62
 
52
     this.connection = this.xmppService.connection;
63
     this.connection = this.xmppService.connection;
53
 
64
 
54
-    // FIXME:
55
-    // Message listener that talks to POPUP window
65
+    // FIXME: Message listener that talks to POPUP window
66
+    /**
67
+     *
68
+     * @param event
69
+     */
56
     function listener(event) {
70
     function listener(event) {
57
         if (event.data && event.data.sessionId) {
71
         if (event.data && event.data.sessionId) {
58
             if (event.origin !== window.location.origin) {
72
             if (event.origin !== window.location.origin) {

+ 9
- 0
modules/xmpp/recording.js 查看文件

8
 
8
 
9
 /* eslint-disable max-params */
9
 /* eslint-disable max-params */
10
 
10
 
11
+/**
12
+ *
13
+ * @param type
14
+ * @param eventEmitter
15
+ * @param connection
16
+ * @param focusMucJid
17
+ * @param jirecon
18
+ * @param roomjid
19
+ */
11
 function Recording(
20
 function Recording(
12
         type,
21
         type,
13
         eventEmitter,
22
         eventEmitter,

+ 45
- 0
modules/xmpp/strophe.emuc.js 查看文件

11
 import { ConnectionPluginListenable } from './ConnectionPlugin';
11
 import { ConnectionPluginListenable } from './ConnectionPlugin';
12
 import XMPPEvents from '../../service/xmpp/XMPPEvents';
12
 import XMPPEvents from '../../service/xmpp/XMPPEvents';
13
 
13
 
14
+/**
15
+ *
16
+ */
14
 class MucConnectionPlugin extends ConnectionPluginListenable {
17
 class MucConnectionPlugin extends ConnectionPluginListenable {
18
+    /**
19
+     *
20
+     * @param xmpp
21
+     */
15
     constructor(xmpp) {
22
     constructor(xmpp) {
16
         super();
23
         super();
17
         this.xmpp = xmpp;
24
         this.xmpp = xmpp;
18
         this.rooms = {};
25
         this.rooms = {};
19
     }
26
     }
20
 
27
 
28
+    /**
29
+     *
30
+     * @param connection
31
+     */
21
     init(connection) {
32
     init(connection) {
22
         super.init(connection);
33
         super.init(connection);
23
 
34
 
34
             'http://jitsi.org/jitmeet/audio', 'iq', 'set', null, null);
45
             'http://jitsi.org/jitmeet/audio', 'iq', 'set', null, null);
35
     }
46
     }
36
 
47
 
48
+    /**
49
+     *
50
+     * @param jid
51
+     * @param password
52
+     * @param options
53
+     */
37
     createRoom(jid, password, options) {
54
     createRoom(jid, password, options) {
38
         const roomJid = Strophe.getBareJidFromJid(jid);
55
         const roomJid = Strophe.getBareJidFromJid(jid);
39
 
56
 
51
         return this.rooms[roomJid];
68
         return this.rooms[roomJid];
52
     }
69
     }
53
 
70
 
71
+    /**
72
+     *
73
+     * @param jid
74
+     */
54
     doLeave(jid) {
75
     doLeave(jid) {
55
         this.eventEmitter.emit(
76
         this.eventEmitter.emit(
56
             XMPPEvents.EMUC_ROOM_REMOVED, this.rooms[jid]);
77
             XMPPEvents.EMUC_ROOM_REMOVED, this.rooms[jid]);
57
         delete this.rooms[jid];
78
         delete this.rooms[jid];
58
     }
79
     }
59
 
80
 
81
+    /**
82
+     *
83
+     * @param pres
84
+     */
60
     onPresence(pres) {
85
     onPresence(pres) {
61
         const from = pres.getAttribute('from');
86
         const from = pres.getAttribute('from');
62
 
87
 
82
         return true;
107
         return true;
83
     }
108
     }
84
 
109
 
110
+    /**
111
+     *
112
+     * @param pres
113
+     */
85
     onPresenceUnavailable(pres) {
114
     onPresenceUnavailable(pres) {
86
         const from = pres.getAttribute('from');
115
         const from = pres.getAttribute('from');
87
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
116
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
95
         return true;
124
         return true;
96
     }
125
     }
97
 
126
 
127
+    /**
128
+     *
129
+     * @param pres
130
+     */
98
     onPresenceError(pres) {
131
     onPresenceError(pres) {
99
         const from = pres.getAttribute('from');
132
         const from = pres.getAttribute('from');
100
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
133
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
108
         return true;
141
         return true;
109
     }
142
     }
110
 
143
 
144
+    /**
145
+     *
146
+     * @param msg
147
+     */
111
     onMessage(msg) {
148
     onMessage(msg) {
112
         // FIXME: this is a hack. but jingle on muc makes nickchanges hard
149
         // FIXME: this is a hack. but jingle on muc makes nickchanges hard
113
         const from = msg.getAttribute('from');
150
         const from = msg.getAttribute('from');
122
         return true;
159
         return true;
123
     }
160
     }
124
 
161
 
162
+    /**
163
+     *
164
+     * @param iq
165
+     */
125
     onMute(iq) {
166
     onMute(iq) {
126
         const from = iq.getAttribute('from');
167
         const from = iq.getAttribute('from');
127
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
168
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
136
     }
177
     }
137
 }
178
 }
138
 
179
 
180
+/**
181
+ *
182
+ * @param XMPP
183
+ */
139
 export default function(XMPP) {
184
 export default function(XMPP) {
140
     Strophe.addConnectionPlugin('emuc', new MucConnectionPlugin(XMPP));
185
     Strophe.addConnectionPlugin('emuc', new MucConnectionPlugin(XMPP));
141
 }
186
 }

+ 25
- 0
modules/xmpp/strophe.jingle.js 查看文件

13
 // function call chains.
13
 // function call chains.
14
 /* eslint-disable newline-per-chained-call */
14
 /* eslint-disable newline-per-chained-call */
15
 
15
 
16
+/**
17
+ *
18
+ */
16
 class JingleConnectionPlugin extends ConnectionPlugin {
19
 class JingleConnectionPlugin extends ConnectionPlugin {
20
+    /**
21
+     *
22
+     * @param xmpp
23
+     * @param eventEmitter
24
+     */
17
     constructor(xmpp, eventEmitter) {
25
     constructor(xmpp, eventEmitter) {
18
         super();
26
         super();
19
         this.xmpp = xmpp;
27
         this.xmpp = xmpp;
30
         };
38
         };
31
     }
39
     }
32
 
40
 
41
+    /**
42
+     *
43
+     * @param connection
44
+     */
33
     init(connection) {
45
     init(connection) {
34
         super.init(connection);
46
         super.init(connection);
35
         this.connection.addHandler(this.onJingle.bind(this),
47
         this.connection.addHandler(this.onJingle.bind(this),
36
             'urn:xmpp:jingle:1', 'iq', 'set', null, null);
48
             'urn:xmpp:jingle:1', 'iq', 'set', null, null);
37
     }
49
     }
38
 
50
 
51
+    /**
52
+     *
53
+     * @param iq
54
+     */
39
     onJingle(iq) {
55
     onJingle(iq) {
40
         const sid = $(iq).find('jingle').attr('sid');
56
         const sid = $(iq).find('jingle').attr('sid');
41
         const action = $(iq).find('jingle').attr('action');
57
         const action = $(iq).find('jingle').attr('action');
186
         return true;
202
         return true;
187
     }
203
     }
188
 
204
 
205
+    /**
206
+     *
207
+     * @param sid
208
+     * @param reasonCondition
209
+     * @param reasonText
210
+     */
189
     terminate(sid, reasonCondition, reasonText) {
211
     terminate(sid, reasonCondition, reasonText) {
190
         if (this.sessions.hasOwnProperty(sid)) {
212
         if (this.sessions.hasOwnProperty(sid)) {
191
             if (this.sessions[sid].state !== 'ended') {
213
             if (this.sessions[sid].state !== 'ended') {
195
         }
217
         }
196
     }
218
     }
197
 
219
 
220
+    /**
221
+     *
222
+     */
198
     getStunAndTurnCredentials() {
223
     getStunAndTurnCredentials() {
199
         // get stun and turn configuration from server via xep-0215
224
         // get stun and turn configuration from server via xep-0215
200
         // uses time-limited credentials as described in
225
         // uses time-limited credentials as described in

+ 18
- 0
modules/xmpp/strophe.logger.js 查看文件

5
  *  Logs raw stanzas and makes them available for download as JSON
5
  *  Logs raw stanzas and makes them available for download as JSON
6
  */
6
  */
7
 class StropheLogger extends ConnectionPlugin {
7
 class StropheLogger extends ConnectionPlugin {
8
+    /**
9
+     *
10
+     */
8
     constructor() {
11
     constructor() {
9
         super();
12
         super();
10
         this.log = [];
13
         this.log = [];
11
     }
14
     }
12
 
15
 
16
+    /**
17
+     *
18
+     * @param connection
19
+     */
13
     init(connection) {
20
     init(connection) {
14
         super.init(connection);
21
         super.init(connection);
15
         this.connection.rawInput = this.logIncoming.bind(this);
22
         this.connection.rawInput = this.logIncoming.bind(this);
16
         this.connection.rawOutput = this.logOutgoing.bind(this);
23
         this.connection.rawOutput = this.logOutgoing.bind(this);
17
     }
24
     }
18
 
25
 
26
+    /**
27
+     *
28
+     * @param stanza
29
+     */
19
     logIncoming(stanza) {
30
     logIncoming(stanza) {
20
         this.log.push([ new Date().getTime(), 'incoming', stanza ]);
31
         this.log.push([ new Date().getTime(), 'incoming', stanza ]);
21
     }
32
     }
22
 
33
 
34
+    /**
35
+     *
36
+     * @param stanza
37
+     */
23
     logOutgoing(stanza) {
38
     logOutgoing(stanza) {
24
         this.log.push([ new Date().getTime(), 'outgoing', stanza ]);
39
         this.log.push([ new Date().getTime(), 'outgoing', stanza ]);
25
     }
40
     }
26
 }
41
 }
27
 
42
 
43
+/**
44
+ *
45
+ */
28
 export default function() {
46
 export default function() {
29
     Strophe.addConnectionPlugin('logger', new StropheLogger());
47
     Strophe.addConnectionPlugin('logger', new StropheLogger());
30
 }
48
 }

+ 4
- 0
modules/xmpp/strophe.ping.js 查看文件

141
     }
141
     }
142
 }
142
 }
143
 
143
 
144
+/**
145
+ *
146
+ * @param xmpp
147
+ */
144
 export default function(xmpp) {
148
 export default function(xmpp) {
145
     Strophe.addConnectionPlugin('ping', new PingConnectionPlugin(xmpp));
149
     Strophe.addConnectionPlugin('ping', new PingConnectionPlugin(xmpp));
146
 }
150
 }

+ 25
- 0
modules/xmpp/strophe.rayo.js 查看文件

7
 
7
 
8
 const RAYO_XMLNS = 'urn:xmpp:rayo:1';
8
 const RAYO_XMLNS = 'urn:xmpp:rayo:1';
9
 
9
 
10
+/**
11
+ *
12
+ */
10
 class RayoConnectionPlugin extends ConnectionPlugin {
13
 class RayoConnectionPlugin extends ConnectionPlugin {
14
+    /**
15
+     *
16
+     * @param connection
17
+     */
11
     init(connection) {
18
     init(connection) {
12
         super.init(connection);
19
         super.init(connection);
13
 
20
 
15
             this.onRayo.bind(this), RAYO_XMLNS, 'iq', 'set', null, null);
22
             this.onRayo.bind(this), RAYO_XMLNS, 'iq', 'set', null, null);
16
     }
23
     }
17
 
24
 
25
+    /**
26
+     *
27
+     * @param iq
28
+     */
18
     onRayo(iq) {
29
     onRayo(iq) {
19
         logger.info('Rayo IQ', iq);
30
         logger.info('Rayo IQ', iq);
20
     }
31
     }
21
 
32
 
22
     /* eslint-disable max-params */
33
     /* eslint-disable max-params */
23
 
34
 
35
+    /**
36
+     *
37
+     * @param to
38
+     * @param from
39
+     * @param roomName
40
+     * @param roomPass
41
+     * @param focusMucJid
42
+     */
24
     dial(to, from, roomName, roomPass, focusMucJid) {
43
     dial(to, from, roomName, roomPass, focusMucJid) {
25
         return new Promise((resolve, reject) => {
44
         return new Promise((resolve, reject) => {
26
             if (!focusMucJid) {
45
             if (!focusMucJid) {
71
 
90
 
72
     /* eslint-enable max-params */
91
     /* eslint-enable max-params */
73
 
92
 
93
+    /**
94
+     *
95
+     */
74
     hangup() {
96
     hangup() {
75
         return new Promise((resolve, reject) => {
97
         return new Promise((resolve, reject) => {
76
             if (!this.callResource) {
98
             if (!this.callResource) {
102
     }
124
     }
103
 }
125
 }
104
 
126
 
127
+/**
128
+ *
129
+ */
105
 export default function() {
130
 export default function() {
106
     Strophe.addConnectionPlugin('rayo', new RayoConnectionPlugin());
131
     Strophe.addConnectionPlugin('rayo', new RayoConnectionPlugin());
107
 }
132
 }

+ 3
- 0
modules/xmpp/strophe.util.js 查看文件

41
 const lastErrorStatusRegExpr
41
 const lastErrorStatusRegExpr
42
     = /request errored, status: (\d+), number of errors: \d+/;
42
     = /request errored, status: (\d+), number of errors: \d+/;
43
 
43
 
44
+/**
45
+ *
46
+ */
44
 export default function() {
47
 export default function() {
45
 
48
 
46
     Strophe.log = function(level, msg) {
49
     Strophe.log = function(level, msg) {

+ 49
- 0
modules/xmpp/xmpp.js 查看文件

16
 import Listenable from '../util/Listenable';
16
 import Listenable from '../util/Listenable';
17
 import Caps from './Caps';
17
 import Caps from './Caps';
18
 
18
 
19
+/**
20
+ *
21
+ * @param token
22
+ * @param bosh
23
+ */
19
 function createConnection(token, bosh = '/http-bind') {
24
 function createConnection(token, bosh = '/http-bind') {
20
     // Append token as URL param
25
     // Append token as URL param
21
     if (token) {
26
     if (token) {
26
     return new Strophe.Connection(bosh);
31
     return new Strophe.Connection(bosh);
27
 }
32
 }
28
 
33
 
34
+/**
35
+ *
36
+ */
29
 export default class XMPP extends Listenable {
37
 export default class XMPP extends Listenable {
38
+    /**
39
+     *
40
+     * @param options
41
+     * @param token
42
+     */
30
     constructor(options, token) {
43
     constructor(options, token) {
31
         super();
44
         super();
32
         this.connection = null;
45
         this.connection = null;
95
         }
108
         }
96
     }
109
     }
97
 
110
 
111
+    /**
112
+     *
113
+     */
98
     getConnection() {
114
     getConnection() {
99
         return this.connection;
115
         return this.connection;
100
     }
116
     }
203
         }
219
         }
204
     }
220
     }
205
 
221
 
222
+    /**
223
+     *
224
+     * @param jid
225
+     * @param password
226
+     */
206
     _connect(jid, password) {
227
     _connect(jid, password) {
207
         // connection.connect() starts the connection process.
228
         // connection.connect() starts the connection process.
208
         //
229
         //
254
             this.connectionHandler.bind(this, options.password));
275
             this.connectionHandler.bind(this, options.password));
255
     }
276
     }
256
 
277
 
278
+    /**
279
+     *
280
+     * @param jid
281
+     * @param password
282
+     */
257
     connect(jid, password) {
283
     connect(jid, password) {
258
         this.connectParams = {
284
         this.connectParams = {
259
             jid,
285
             jid,
280
         return this._connect(jid, password);
306
         return this._connect(jid, password);
281
     }
307
     }
282
 
308
 
309
+    /**
310
+     *
311
+     * @param roomName
312
+     * @param options
313
+     */
283
     createRoom(roomName, options) {
314
     createRoom(roomName, options) {
284
         // By default MUC nickname is the resource part of the JID
315
         // By default MUC nickname is the resource part of the JID
285
         let mucNickname = Strophe.getNodeFromJid(this.connection.jid);
316
         let mucNickname = Strophe.getNodeFromJid(this.connection.jid);
324
         return (this.connection.logger || {}).log || null;
355
         return (this.connection.logger || {}).log || null;
325
     }
356
     }
326
 
357
 
358
+    /**
359
+     *
360
+     */
327
     dial(...args) {
361
     dial(...args) {
328
         this.connection.rayo.dial(...args);
362
         this.connection.rayo.dial(...args);
329
     }
363
     }
330
 
364
 
365
+    /**
366
+     *
367
+     * @param jid
368
+     * @param mute
369
+     */
331
     setMute(jid, mute) {
370
     setMute(jid, mute) {
332
         this.connection.moderate.setMute(jid, mute);
371
         this.connection.moderate.setMute(jid, mute);
333
     }
372
     }
334
 
373
 
374
+    /**
375
+     *
376
+     * @param jid
377
+     */
335
     eject(jid) {
378
     eject(jid) {
336
         this.connection.moderate.eject(jid);
379
         this.connection.moderate.eject(jid);
337
     }
380
     }
338
 
381
 
382
+    /**
383
+     *
384
+     */
339
     getSessions() {
385
     getSessions() {
340
         return this.connection.jingle.sessions;
386
         return this.connection.jingle.sessions;
341
     }
387
     }
391
         }
437
         }
392
     }
438
     }
393
 
439
 
440
+    /**
441
+     *
442
+     */
394
     _initStrophePlugins() {
443
     _initStrophePlugins() {
395
         initEmuc(this);
444
         initEmuc(this);
396
         initJingle(this, this.eventEmitter);
445
         initJingle(this, this.eventEmitter);

正在加载...
取消
保存