Sfoglia il codice sorgente

ref: module.exports -> export for the ES6 modules

j8
hristoterezov 8 anni fa
parent
commit
4d329b510f

+ 1
- 0
.jshintignore Vedi File

@@ -16,6 +16,7 @@ react/
16 16
 # The following are checked by ESLint with the minimum configuration which does
17 17
 # not supersede JSHint but take advantage of advanced language features such as
18 18
 # Facebook Flow which are not supported by JSHint.
19
+app.js
19 20
 modules/translation/translation.js
20 21
 
21 22
 analytics.js

+ 38
- 49
app.js Vedi File

@@ -15,59 +15,50 @@ import 'aui-experimental-css';
15 15
 
16 16
 window.toastr = require("toastr");
17 17
 
18
-import conference from './conference';
19
-import API from './modules/API';
20
-import keyboardshortcut from './modules/keyboardshortcut/keyboardshortcut';
21
-import remoteControl from "./modules/remotecontrol/RemoteControl";
22
-import settings from "./modules/settings/Settings";
23
-import translation from "./modules/translation/translation";
24
-import UI from "./modules/UI/UI";
18
+export conference from './conference';
19
+export API from './modules/API';
20
+export keyboardshortcut from './modules/keyboardshortcut/keyboardshortcut';
21
+export remoteControl from "./modules/remotecontrol/RemoteControl";
22
+export settings from "./modules/settings/Settings";
23
+export translation from "./modules/translation/translation";
24
+export UI from "./modules/UI/UI";
25 25
 
26
-const APP = {
27
-    API,
28
-    conference,
26
+/**
27
+ * After the APP has been initialized provides utility methods for dealing
28
+ * with the conference room URL(address).
29
+ * @type ConferenceUrl
30
+ */
31
+export let ConferenceUrl = null;
29 32
 
30
-    /**
31
-     * After the APP has been initialized provides utility methods for dealing
32
-     * with the conference room URL(address).
33
-     * @type ConferenceUrl
34
-     */
35
-    ConferenceUrl: null,
33
+// Used by do_external_connect.js if we receive the attach data after
34
+// connect was already executed. status property can be "initialized",
35
+// "ready" or "connecting". We are interested in "ready" status only which
36
+// means that connect was executed but we have to wait for the attach data.
37
+// In status "ready" handler property will be set to a function that will
38
+// finish the connect process when the attach data or error is received.
39
+export const connect = {
40
+    status: "initialized",
41
+    handler: null
42
+};
36 43
 
37
-    // Used by do_external_connect.js if we receive the attach data after
38
-    // connect was already executed. status property can be "initialized",
39
-    // "ready" or "connecting". We are interested in "ready" status only which
40
-    // means that connect was executed but we have to wait for the attach data.
41
-    // In status "ready" handler property will be set to a function that will
42
-    // finish the connect process when the attach data or error is received.
43
-    connect: {
44
-        status: "initialized",
45
-        handler: null
46
-    },
47
-    connection: null,
44
+export let connection = null;
48 45
 
49
-    // Used for automated performance tests
50
-    connectionTimes: {
51
-        "index.loaded": window.indexLoadedTime
52
-    },
53
-    keyboardshortcut,
46
+// Used for automated performance tests
47
+export const connectionTimes = {
48
+    "index.loaded": window.indexLoadedTime
49
+};
54 50
 
55
-    /**
56
-     * The log collector which captures JS console logs for this app.
57
-     * @type {LogCollector}
58
-     */
59
-    logCollector: null,
51
+/**
52
+ * The log collector which captures JS console logs for this app.
53
+ * @type {LogCollector}
54
+ */
55
+export let logCollector = null;
60 56
 
61
-    /**
62
-     * Indicates if the log collector has been started (it will not be started
63
-     * if the welcome page is displayed).
64
-     */
65
-    logCollectorStarted : false,
66
-    remoteControl,
67
-    settings,
68
-    translation,
69
-    UI
70
-};
57
+/**
58
+ * Indicates if the log collector has been started (it will not be started
59
+ * if the welcome page is displayed).
60
+ */
61
+export let logCollectorStarted = false;
71 62
 
72 63
 // TODO The execution of the mobile app starts from react/index.native.js.
73 64
 // Similarly, the execution of the Web app should start from react/index.web.js
@@ -76,5 +67,3 @@ const APP = {
76 67
 // the execution of the Web app to start from app.js in order to reduce the
77 68
 // complexity of the beginning step.
78 69
 import './react';
79
-
80
-module.exports = APP;

+ 1
- 3
modules/API/external/external_api.js Vedi File

@@ -145,7 +145,7 @@ function generateURL(domain, options = {}) {
145 145
 /**
146 146
  * The IFrame API interface class.
147 147
  */
148
-class JitsiMeetExternalAPI extends EventEmitter {
148
+export default class JitsiMeetExternalAPI extends EventEmitter {
149 149
     /**
150 150
      * Constructs new API instance. Creates iframe and loads Jitsi Meet in it.
151 151
      *
@@ -424,5 +424,3 @@ class JitsiMeetExternalAPI extends EventEmitter {
424 424
         eventList.forEach(event => this.removeEventListener(event));
425 425
     }
426 426
 }
427
-
428
-module.exports = JitsiMeetExternalAPI;

+ 3
- 0
modules/API/external/index.js Vedi File

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

+ 8
- 6
modules/UI/UI.js Vedi File

@@ -8,6 +8,8 @@ import Chat from "./side_pannels/chat/Chat";
8 8
 import SidePanels from "./side_pannels/SidePanels";
9 9
 import Avatar from "./avatar/Avatar";
10 10
 import SideContainerToggler from "./side_pannels/SideContainerToggler";
11
+import JitsiPopover from "./util/JitsiPopover";
12
+import messageHandler from "./util/MessageHandler";
11 13
 import UIUtil from "./util/UIUtil";
12 14
 import UIEvents from "../../service/UI/UIEvents";
13 15
 import EtherpadManager from './etherpad/Etherpad';
@@ -19,7 +21,7 @@ import Filmstrip from "./videolayout/Filmstrip";
19 21
 import SettingsMenu from "./side_pannels/settings/SettingsMenu";
20 22
 import Profile from "./side_pannels/profile/Profile";
21 23
 import Settings from "./../settings/Settings";
22
-import UIErrors from './UIErrors';
24
+import { FEEDBACK_REQUEST_IN_PROGRESS } from './UIErrors';
23 25
 import { debounce } from "../util/helpers";
24 26
 
25 27
 import { updateDeviceList } from '../../react/features/base/devices';
@@ -41,9 +43,7 @@ import {
41 43
 } from '../../react/features/toolbox';
42 44
 
43 45
 var EventEmitter = require("events");
44
-UI.messageHandler = require("./util/MessageHandler");
45
-var messageHandler = UI.messageHandler;
46
-var JitsiPopover = require("./util/JitsiPopover");
46
+UI.messageHandler = messageHandler;
47 47
 import Feedback from "./feedback/Feedback";
48 48
 import FollowMe from "../FollowMe";
49 49
 
@@ -1033,7 +1033,7 @@ UI.updateDTMFSupport
1033 1033
  */
1034 1034
 UI.requestFeedbackOnHangup = function () {
1035 1035
     if (Feedback.isVisible())
1036
-        return Promise.reject(UIErrors.FEEDBACK_REQUEST_IN_PROGRESS);
1036
+        return Promise.reject(FEEDBACK_REQUEST_IN_PROGRESS);
1037 1037
     // Feedback has been submitted already.
1038 1038
     else if (Feedback.isEnabled() && Feedback.isSubmitted()) {
1039 1039
         return Promise.resolve({
@@ -1443,4 +1443,6 @@ const UIListeners = new Map([
1443 1443
     ]
1444 1444
 ]);
1445 1445
 
1446
-module.exports = UI;
1446
+// TODO: Export every function separately. For now there is no point of doing
1447
+// this because we are importing everything.
1448
+export default UI;

+ 7
- 7
modules/UI/UIErrors.js Vedi File

@@ -1,10 +1,10 @@
1 1
 /**
2 2
  * A list of all UI errors.
3 3
  */
4
-module.exports = {
5
-    /**
6
-     * Indicates that a Feedback request is currently in progress.
7
-     * @type {{FEEDBACK_REQUEST_IN_PROGRESS: string}}
8
-     */
9
-    FEEDBACK_REQUEST_IN_PROGRESS: "FeedbackRequestInProgress"
10
-};
4
+
5
+/**
6
+ * Indicates that a Feedback request is currently in progress.
7
+ *
8
+ * @type {{FEEDBACK_REQUEST_IN_PROGRESS: string}}
9
+ */
10
+export const FEEDBACK_REQUEST_IN_PROGRESS = "FeedbackRequestInProgress";

+ 1
- 3
modules/UI/util/JitsiPopover.js Vedi File

@@ -77,7 +77,7 @@ const positionConfigurations = {
77 77
         }
78 78
     }
79 79
 };
80
-var JitsiPopover = (function () {
80
+export default (function () {
81 81
     /**
82 82
      * The default options
83 83
      */
@@ -294,5 +294,3 @@ var JitsiPopover = (function () {
294 294
 
295 295
     return JitsiPopover;
296 296
 })();
297
-
298
-module.exports = JitsiPopover;

+ 1
- 1
modules/UI/util/MessageHandler.js Vedi File

@@ -504,4 +504,4 @@ var messageHandler = {
504 504
     }
505 505
 };
506 506
 
507
-module.exports = messageHandler;
507
+export default messageHandler;

+ 2
- 2
modules/keyboardshortcut/keyboardshortcut.js Vedi File

@@ -82,7 +82,7 @@ let enabled = true;
82 82
 /**
83 83
  * Maps keycode to character, id of popover for given function and function.
84 84
  */
85
-var KeyboardShortcut = {
85
+const KeyboardShortcut = {
86 86
     init: function () {
87 87
         initGlobalShortcuts();
88 88
 
@@ -273,4 +273,4 @@ var KeyboardShortcut = {
273 273
     }
274 274
 };
275 275
 
276
-module.exports = KeyboardShortcut;
276
+export default KeyboardShortcut;

+ 1
- 1
webpack.config.js Vedi File

@@ -188,7 +188,7 @@ const configs = [
188 188
     // JitsiMeetExternalAPI).
189 189
     Object.assign({}, config, {
190 190
         entry: {
191
-            'external_api': './modules/API/external/external_api.js'
191
+            'external_api': './modules/API/external/index.js'
192 192
         },
193 193
         output: Object.assign({}, config.output, {
194 194
             library: 'JitsiMeetExternalAPI'

Loading…
Annulla
Salva