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
# not supersede JSHint but take advantage of advanced language features such as
# Facebook Flow which are not supported by JSHint.
app.js
modules/translation/translation.js
analytics.js

63
app.js
View File

@ -15,59 +15,50 @@ import 'aui-experimental-css';
window.toastr = require("toastr");
import conference from './conference';
import API from './modules/API';
import keyboardshortcut from './modules/keyboardshortcut/keyboardshortcut';
import remoteControl from "./modules/remotecontrol/RemoteControl";
import settings from "./modules/settings/Settings";
import translation from "./modules/translation/translation";
import UI from "./modules/UI/UI";
export conference from './conference';
export API from './modules/API';
export keyboardshortcut from './modules/keyboardshortcut/keyboardshortcut';
export remoteControl from "./modules/remotecontrol/RemoteControl";
export settings from "./modules/settings/Settings";
export translation from "./modules/translation/translation";
export UI from "./modules/UI/UI";
const APP = {
API,
conference,
/**
/**
* After the APP has been initialized provides utility methods for dealing
* with the conference room URL(address).
* @type ConferenceUrl
*/
ConferenceUrl: null,
export let ConferenceUrl = null;
// Used by do_external_connect.js if we receive the attach data after
// connect was already executed. status property can be "initialized",
// "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: {
// Used by do_external_connect.js if we receive the attach data after
// connect was already executed. status property can be "initialized",
// "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.
export const connect = {
status: "initialized",
handler: null
},
connection: null,
};
// Used for automated performance tests
connectionTimes: {
export let connection = null;
// Used for automated performance tests
export const connectionTimes = {
"index.loaded": window.indexLoadedTime
},
keyboardshortcut,
};
/**
/**
* The log collector which captures JS console logs for this app.
* @type {LogCollector}
*/
logCollector: null,
export let 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 logCollectorStarted = false;
// 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
@ -76,5 +67,3 @@ const APP = {
// the execution of the Web app to start from app.js in order to reduce the
// complexity of the beginning step.
import './react';
module.exports = APP;

View File

@ -145,7 +145,7 @@ function generateURL(domain, options = {}) {
/**
* 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.
*
@ -424,5 +424,3 @@ class JitsiMeetExternalAPI extends EventEmitter {
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 Avatar from "./avatar/Avatar";
import SideContainerToggler from "./side_pannels/SideContainerToggler";
import JitsiPopover from "./util/JitsiPopover";
import messageHandler from "./util/MessageHandler";
import UIUtil from "./util/UIUtil";
import UIEvents from "../../service/UI/UIEvents";
import EtherpadManager from './etherpad/Etherpad';
@ -19,7 +21,7 @@ import Filmstrip from "./videolayout/Filmstrip";
import SettingsMenu from "./side_pannels/settings/SettingsMenu";
import Profile from "./side_pannels/profile/Profile";
import Settings from "./../settings/Settings";
import UIErrors from './UIErrors';
import { FEEDBACK_REQUEST_IN_PROGRESS } from './UIErrors';
import { debounce } from "../util/helpers";
import { updateDeviceList } from '../../react/features/base/devices';
@ -41,9 +43,7 @@ import {
} from '../../react/features/toolbox';
var EventEmitter = require("events");
UI.messageHandler = require("./util/MessageHandler");
var messageHandler = UI.messageHandler;
var JitsiPopover = require("./util/JitsiPopover");
UI.messageHandler = messageHandler;
import Feedback from "./feedback/Feedback";
import FollowMe from "../FollowMe";
@ -1033,7 +1033,7 @@ UI.updateDTMFSupport
*/
UI.requestFeedbackOnHangup = function () {
if (Feedback.isVisible())
return Promise.reject(UIErrors.FEEDBACK_REQUEST_IN_PROGRESS);
return Promise.reject(FEEDBACK_REQUEST_IN_PROGRESS);
// Feedback has been submitted already.
else if (Feedback.isEnabled() && Feedback.isSubmitted()) {
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.
*/
module.exports = {
/**
/**
* Indicates that a Feedback request is currently in progress.
*
* @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
*/
@ -294,5 +294,3 @@ var JitsiPopover = (function () {
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.
*/
var KeyboardShortcut = {
const KeyboardShortcut = {
init: function () {
initGlobalShortcuts();
@ -273,4 +273,4 @@ var KeyboardShortcut = {
}
};
module.exports = KeyboardShortcut;
export default KeyboardShortcut;

View File

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