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

This commit is contained in:
hristoterezov 2017-06-14 13:13:41 -05:00 committed by Lyubo Marinov
parent a30e880876
commit 4d329b510f
10 changed files with 66 additions and 75 deletions

View File

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

93
app.js
View File

@ -15,60 +15,51 @@ import 'aui-experimental-css';
window.toastr = require("toastr"); window.toastr = require("toastr");
import conference from './conference'; export conference from './conference';
import API from './modules/API'; export API from './modules/API';
import keyboardshortcut from './modules/keyboardshortcut/keyboardshortcut'; export keyboardshortcut from './modules/keyboardshortcut/keyboardshortcut';
import remoteControl from "./modules/remotecontrol/RemoteControl"; export remoteControl from "./modules/remotecontrol/RemoteControl";
import settings from "./modules/settings/Settings"; export settings from "./modules/settings/Settings";
import translation from "./modules/translation/translation"; export translation from "./modules/translation/translation";
import UI from "./modules/UI/UI"; export UI from "./modules/UI/UI";
const APP = { /**
API, * After the APP has been initialized provides utility methods for dealing
conference, * with the conference room URL(address).
* @type ConferenceUrl
*/
export let ConferenceUrl = null;
/** // Used by do_external_connect.js if we receive the attach data after
* After the APP has been initialized provides utility methods for dealing // connect was already executed. status property can be "initialized",
* with the conference room URL(address). // "ready" or "connecting". We are interested in "ready" status only which
* @type ConferenceUrl // means that connect was executed but we have to wait for the attach data.
*/ // In status "ready" handler property will be set to a function that will
ConferenceUrl: null, // finish the connect process when the attach data or error is received.
export const connect = {
// Used by do_external_connect.js if we receive the attach data after status: "initialized",
// connect was already executed. status property can be "initialized", handler: null
// "ready" or "connecting". We are interested in "ready" status only which
// means that connect was executed but we have to wait for the attach data.
// In status "ready" handler property will be set to a function that will
// finish the connect process when the attach data or error is received.
connect: {
status: "initialized",
handler: null
},
connection: null,
// Used for automated performance tests
connectionTimes: {
"index.loaded": window.indexLoadedTime
},
keyboardshortcut,
/**
* The log collector which captures JS console logs for this app.
* @type {LogCollector}
*/
logCollector: null,
/**
* Indicates if the log collector has been started (it will not be started
* if the welcome page is displayed).
*/
logCollectorStarted : false,
remoteControl,
settings,
translation,
UI
}; };
export let connection = null;
// Used for automated performance tests
export const connectionTimes = {
"index.loaded": window.indexLoadedTime
};
/**
* The log collector which captures JS console logs for this app.
* @type {LogCollector}
*/
export let logCollector = null;
/**
* Indicates if the log collector has been started (it will not be started
* if the welcome page is displayed).
*/
export let logCollectorStarted = false;
// TODO The execution of the mobile app starts from react/index.native.js. // TODO The execution of the mobile app starts from react/index.native.js.
// Similarly, the execution of the Web app should start from react/index.web.js // Similarly, the execution of the Web app should start from react/index.web.js
// for the sake of consistency and ease of understanding. Temporarily though // for the sake of consistency and ease of understanding. Temporarily though
@ -76,5 +67,3 @@ const APP = {
// the execution of the Web app to start from app.js in order to reduce the // the execution of the Web app to start from app.js in order to reduce the
// complexity of the beginning step. // complexity of the beginning step.
import './react'; import './react';
module.exports = APP;

View File

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

3
modules/API/external/index.js vendored Normal file
View File

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

View File

@ -8,6 +8,8 @@ import Chat from "./side_pannels/chat/Chat";
import SidePanels from "./side_pannels/SidePanels"; import SidePanels from "./side_pannels/SidePanels";
import Avatar from "./avatar/Avatar"; import Avatar from "./avatar/Avatar";
import SideContainerToggler from "./side_pannels/SideContainerToggler"; import SideContainerToggler from "./side_pannels/SideContainerToggler";
import JitsiPopover from "./util/JitsiPopover";
import messageHandler from "./util/MessageHandler";
import UIUtil from "./util/UIUtil"; import UIUtil from "./util/UIUtil";
import UIEvents from "../../service/UI/UIEvents"; import UIEvents from "../../service/UI/UIEvents";
import EtherpadManager from './etherpad/Etherpad'; import EtherpadManager from './etherpad/Etherpad';
@ -19,7 +21,7 @@ import Filmstrip from "./videolayout/Filmstrip";
import SettingsMenu from "./side_pannels/settings/SettingsMenu"; import SettingsMenu from "./side_pannels/settings/SettingsMenu";
import Profile from "./side_pannels/profile/Profile"; import Profile from "./side_pannels/profile/Profile";
import Settings from "./../settings/Settings"; import Settings from "./../settings/Settings";
import UIErrors from './UIErrors'; import { FEEDBACK_REQUEST_IN_PROGRESS } from './UIErrors';
import { debounce } from "../util/helpers"; import { debounce } from "../util/helpers";
import { updateDeviceList } from '../../react/features/base/devices'; import { updateDeviceList } from '../../react/features/base/devices';
@ -41,9 +43,7 @@ import {
} from '../../react/features/toolbox'; } from '../../react/features/toolbox';
var EventEmitter = require("events"); var EventEmitter = require("events");
UI.messageHandler = require("./util/MessageHandler"); UI.messageHandler = messageHandler;
var messageHandler = UI.messageHandler;
var JitsiPopover = require("./util/JitsiPopover");
import Feedback from "./feedback/Feedback"; import Feedback from "./feedback/Feedback";
import FollowMe from "../FollowMe"; import FollowMe from "../FollowMe";
@ -1033,7 +1033,7 @@ UI.updateDTMFSupport
*/ */
UI.requestFeedbackOnHangup = function () { UI.requestFeedbackOnHangup = function () {
if (Feedback.isVisible()) if (Feedback.isVisible())
return Promise.reject(UIErrors.FEEDBACK_REQUEST_IN_PROGRESS); return Promise.reject(FEEDBACK_REQUEST_IN_PROGRESS);
// Feedback has been submitted already. // Feedback has been submitted already.
else if (Feedback.isEnabled() && Feedback.isSubmitted()) { else if (Feedback.isEnabled() && Feedback.isSubmitted()) {
return Promise.resolve({ return Promise.resolve({
@ -1443,4 +1443,6 @@ const UIListeners = new Map([
] ]
]); ]);
module.exports = UI; // TODO: Export every function separately. For now there is no point of doing
// this because we are importing everything.
export default UI;

View File

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

View File

@ -77,7 +77,7 @@ const positionConfigurations = {
} }
} }
}; };
var JitsiPopover = (function () { export default (function () {
/** /**
* The default options * The default options
*/ */
@ -294,5 +294,3 @@ var JitsiPopover = (function () {
return JitsiPopover; return JitsiPopover;
})(); })();
module.exports = JitsiPopover;

View File

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

View File

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

View File

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