Browse Source

Prepare for webpack 2

Webpack 2 defines module.exports as a read-only property in ES6 modules.
master
Lyubo Marinov 8 years ago
parent
commit
45a5f64326

+ 8
- 9
JitsiMeetJS.js View File

@@ -85,9 +85,9 @@ function addDeviceTypeToAnalyticsEvent(name, options) {
85 85
 }
86 86
 
87 87
 /**
88
- * Namespace for the interface of Jitsi Meet Library.
88
+ * The public API of the Jitsi Meet library (a.k.a. JitsiMeetJS).
89 89
  */
90
-const LibJitsiMeet = {
90
+export default {
91 91
 
92 92
     version: '{#COMMIT_HASH#}',
93 93
 
@@ -308,13 +308,14 @@ const LibJitsiMeet = {
308 308
                     if (newResolution !== null) {
309 309
                         options.resolution = newResolution;
310 310
 
311
-                        logger.debug('Retry createLocalTracks with resolution',
311
+                        logger.debug(
312
+                            'Retry createLocalTracks with resolution',
312 313
                             newResolution);
313 314
 
314 315
                         Statistics.analytics.sendEvent(
315 316
                             `getUserMedia.fail.resolution.${oldResolution}`);
316 317
 
317
-                        return LibJitsiMeet.createLocalTracks(options);
318
+                        return this.createLocalTracks(options);
318 319
                     }
319 320
                 }
320 321
 
@@ -453,13 +454,11 @@ const LibJitsiMeet = {
453 454
 
454 455
     /**
455 456
      * Represents a hub/namespace for utility functionality which may be of
456
-     * interest to LibJitsiMeet clients.
457
+     * interest to lib-jitsi-meet clients.
457 458
      */
458 459
     util: {
459
-        ScriptUtil,
460
+        AuthUtil,
460 461
         RTCUIHelper,
461
-        AuthUtil
462
+        ScriptUtil
462 463
     }
463 464
 };
464
-
465
-module.exports = LibJitsiMeet;

+ 3
- 0
index.js View File

@@ -0,0 +1,3 @@
1
+// For legacy purposes, preserve the UMD of the public API of the Jitsi Meet
2
+// library (a.k.a. JitsiMeetJS).
3
+module.exports = require('./JitsiMeetJS').default;

+ 2
- 2
karma.conf.js View File

@@ -15,7 +15,7 @@ module.exports = function(config) {
15 15
 
16 16
     // list of files / patterns to load in the browser
17 17
         files: [
18
-            './JitsiMeetJS.js',
18
+            './index.js',
19 19
             './modules/**/*.spec.js'
20 20
         ],
21 21
 
@@ -29,7 +29,7 @@ module.exports = function(config) {
29 29
     // available preprocessors:
30 30
     //  https://npmjs.org/browse/keyword/karma-preprocessor
31 31
         preprocessors: {
32
-            './JitsiMeetJS.js': [ 'webpack' ],
32
+            './index.js': [ 'webpack' ],
33 33
             './**/*.spec.js': [ 'webpack' ]
34 34
         },
35 35
 

+ 8
- 9
modules/statistics/RTPStatsCollector.js View File

@@ -10,8 +10,8 @@ const browserSupported = RTCBrowserType.isChrome()
10 10
         || RTCBrowserType.isNWJS() || RTCBrowserType.isElectron();
11 11
 
12 12
 /**
13
- * The LibJitsiMeet browser-agnostic names of the browser-specific keys reported
14
- * by RTCPeerConnection#getStats mapped by RTCBrowserType.
13
+ * The lib-jitsi-meet browser-agnostic names of the browser-specific keys
14
+ * reported by RTCPeerConnection#getStats mapped by RTCBrowserType.
15 15
  */
16 16
 const KEYS_BY_BROWSER_TYPE = {};
17 17
 
@@ -207,8 +207,9 @@ export default function StatsCollector(
207 207
 
208 208
     /**
209 209
      * The function which is to be used to retrieve the value associated in a
210
-     * report returned by RTCPeerConnection#getStats with a LibJitsiMeet
210
+     * report returned by RTCPeerConnection#getStats with a lib-jitsi-meet
211 211
      * browser-agnostic name/key.
212
+     *
212 213
      * @function
213 214
      * @private
214 215
      */
@@ -329,13 +330,13 @@ StatsCollector.prototype.start = function(startAudioLevelStats) {
329 330
 /**
330 331
  * Defines a function which (1) is to be used as a StatsCollector method and (2)
331 332
  * gets the value from a specific report returned by RTCPeerConnection#getStats
332
- * associated with a LibJitsiMeet browser-agnostic name.
333
+ * associated with a lib-jitsi-meet browser-agnostic name.
333 334
  *
334 335
  * @param {Object.<string,string>} keys the map of LibJitsi browser-agnostic
335 336
  * names to RTCPeerConnection#getStats browser-specific keys
336 337
  */
337 338
 StatsCollector.prototype._defineGetStatValueMethod = function(keys) {
338
-    // Define the function which converts a LibJitsiMeet browser-asnostic name
339
+    // Define the function which converts a lib-jitsi-meet browser-asnostic name
339 340
     // to a browser-specific key of a report returned by
340 341
     // RTCPeerConnection#getStats.
341 342
     const keyFromName = function(name) {
@@ -395,10 +396,8 @@ StatsCollector.prototype._defineGetStatValueMethod = function(keys) {
395 396
 
396 397
     // Compose the 2 functions defined above to get a function which retrieves
397 398
     // the value from a specific report returned by RTCPeerConnection#getStats
398
-    // associated with a specific LibJitsiMeet browser-agnostic name.
399
-    return function(item, name) {
400
-        return itemStatByKey(item, keyFromName(name));
401
-    };
399
+    // associated with a specific lib-jitsi-meet browser-agnostic name.
400
+    return (item, name) => itemStatByKey(item, keyFromName(name));
402 401
 };
403 402
 
404 403
 /* eslint-disable no-continue */

+ 1
- 3
modules/version/ComponentsVersions.js View File

@@ -28,7 +28,7 @@ ComponentsVersions.XMPP_SERVER_COMPONENT = 'xmpp';
28 28
  *        listen for focus presence updates.
29 29
  * @constructor
30 30
  */
31
-function ComponentsVersions(conference) {
31
+export default function ComponentsVersions(conference) {
32 32
 
33 33
     this.versions = {};
34 34
 
@@ -99,5 +99,3 @@ ComponentsVersions.prototype.processPresence
99 99
 ComponentsVersions.prototype.getComponentVersion = function(componentName) {
100 100
     return this.versions[componentName];
101 101
 };
102
-
103
-module.exports = ComponentsVersions;

+ 1
- 3
modules/xmpp/SDP.js View File

@@ -6,7 +6,7 @@ import SDPUtil from './SDPUtil';
6 6
  *
7 7
  * @param sdp
8 8
  */
9
-function SDP(sdp) {
9
+export default function SDP(sdp) {
10 10
     const media = sdp.split('\r\nm=');
11 11
 
12 12
     for (let i = 1, length = media.length; i < length; i++) {
@@ -852,5 +852,3 @@ SDP.prototype.jingle2media = function(content) {
852 852
 
853 853
     return media;
854 854
 };
855
-
856
-module.exports = SDP;

+ 1
- 3
modules/xmpp/SDPDiffer.js View File

@@ -39,7 +39,7 @@ function arrayEquals(array1, array2) {
39 39
  * @param mySDP
40 40
  * @param otherSDP
41 41
  */
42
-function SDPDiffer(mySDP, otherSDP) {
42
+export default function SDPDiffer(mySDP, otherSDP) {
43 43
     this.mySDP = mySDP;
44 44
     this.otherSDP = otherSDP;
45 45
 }
@@ -190,5 +190,3 @@ SDPDiffer.prototype.toJingle = function(modify) {
190 190
 
191 191
     return modified;
192 192
 };
193
-
194
-module.exports = SDPDiffer;

+ 1
- 1
package.json View File

@@ -57,6 +57,6 @@
57 57
   "pre-commit": [
58 58
     "lint"
59 59
   ],
60
-  "main": "./JitsiMeetJS.js",
60
+  "main": "./index.js",
61 61
   "license": "Apache-2.0"
62 62
 }

+ 1
- 1
webpack.config.js View File

@@ -31,7 +31,7 @@ if (minimize) {
31 31
 module.exports = {
32 32
     devtool: 'source-map',
33 33
     entry: {
34
-        'lib-jitsi-meet': './JitsiMeetJS.js'
34
+        'lib-jitsi-meet': './index.js'
35 35
     },
36 36
     module: {
37 37
         loaders: [ {

Loading…
Cancel
Save