jiti-meet/app.js

107 lines
3.2 KiB
JavaScript
Raw Normal View History

2013-12-16 11:22:23 +00:00
/* jshint -W117 */
/* application specific logic */
2015-09-10 17:15:56 +00:00
require("jquery");
require("jquery-ui");
require("strophe");
require("strophe-disco");
require("strophe-caps");
require("tooltip");
require("popover");
window.toastr = require("toastr");
require("jQuery-Impromptu");
require("autosize");
var APP =
{
init: function () {
this.UI = require("./modules/UI/UI");
this.API = require("./modules/API/API");
this.connectionquality =
require("./modules/connectionquality/connectionquality");
this.statistics = require("./modules/statistics/statistics");
this.RTC = require("./modules/RTC/RTC");
this.desktopsharing =
require("./modules/desktopsharing/desktopsharing");
this.xmpp = require("./modules/xmpp/xmpp");
this.keyboardshortcut =
require("./modules/keyboardshortcut/keyboardshortcut");
this.translation = require("./modules/translation/translation");
2015-03-09 15:50:13 +00:00
this.settings = require("./modules/settings/Settings");
//this.DTMF = require("./modules/DTMF/DTMF");
this.members = require("./modules/members/MemberList");
this.configFetch = require("./modules/config/HttpConfigFetch");
}
};
2013-12-16 11:22:23 +00:00
function init() {
APP.desktopsharing.init();
APP.RTC.start();
APP.xmpp.start();
APP.statistics.start();
APP.connectionquality.init();
APP.keyboardshortcut.init();
APP.members.start();
2013-12-16 11:22:23 +00:00
}
/**
* If we have an HTTP endpoint for getting config.json configured we're going to
* read it and override properties from config.js and interfaceConfig.js.
* If there is no endpoint we'll just continue with initialization.
* Keep in mind that if the endpoint has been configured and we fail to obtain
* the config for any reason then the conference won't start and error message
* will be displayed to the user.
*/
function obtainConfigAndInit() {
var roomName = APP.UI.getRoomNode();
if (config.configLocation) {
APP.configFetch.obtainConfig(
config.configLocation, roomName,
// Get config result callback
function(success, error) {
if (success) {
console.log("(TIME) configuration fetched:\t",
window.performance.now());
init();
} else {
// Show obtain config error,
// pass the error object for report
APP.UI.messageHandler.openReportDialog(
null, "dialog.connectError", error);
}
});
} else {
require("./modules/config/BoshAddressChoice").chooseAddress(
config, roomName);
init();
}
}
2013-12-16 11:22:23 +00:00
$(document).ready(function () {
console.log("(TIME) document ready:\t", window.performance.now());
2015-01-07 14:54:03 +00:00
var URLProcessor = require("./modules/config/URLProcessor");
URLProcessor.setConfigParametersFromUrl();
APP.init();
2014-08-21 16:42:54 +00:00
APP.translation.init();
if(APP.API.isEnabled())
APP.API.init();
APP.UI.start(obtainConfigAndInit);
2015-01-22 16:26:05 +00:00
2013-12-16 11:22:23 +00:00
});
$(window).bind('beforeunload', function () {
if(APP.API.isEnabled())
APP.API.dispose();
2013-12-16 11:22:23 +00:00
});
module.exports = APP;