You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

app.js 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* jshint -W117 */
  2. /* application specific logic */
  3. var APP =
  4. {
  5. init: function () {
  6. this.UI = require("./modules/UI/UI");
  7. this.API = require("./modules/API/API");
  8. this.connectionquality = require("./modules/connectionquality/connectionquality");
  9. this.statistics = require("./modules/statistics/statistics");
  10. this.RTC = require("./modules/RTC/RTC");
  11. this.desktopsharing = require("./modules/desktopsharing/desktopsharing");
  12. this.xmpp = require("./modules/xmpp/xmpp");
  13. this.keyboardshortcut = require("./modules/keyboardshortcut/keyboardshortcut");
  14. this.translation = require("./modules/translation/translation");
  15. this.settings = require("./modules/settings/Settings");
  16. this.DTMF = require("./modules/DTMF/DTMF");
  17. this.members = require("./modules/members/MemberList");
  18. this.configFetch = require("./modules/config/HttpConfigFetch");
  19. }
  20. };
  21. function init() {
  22. APP.desktopsharing.init();
  23. APP.RTC.start();
  24. APP.xmpp.start();
  25. APP.statistics.start();
  26. APP.connectionquality.init();
  27. APP.keyboardshortcut.init();
  28. APP.members.start();
  29. }
  30. /**
  31. * If we have HTTP endpoint for getting confgi.json configured we're going to
  32. * read it and override properties from config.js and interfaceConfig.js.
  33. * If there is no endpoint we'll just continue with initialization.
  34. * Keep in mind that if the endpoint has been configured and we fail to obtain
  35. * the config for any reason then the conference won't start and error message
  36. * will be displayed to the user.
  37. */
  38. function obtainConfigAndInit() {
  39. if (config.configLocation) {
  40. APP.configFetch.obtainConfig(
  41. config.configLocation, APP.UI.getRoomNode(),
  42. // Get config result callback
  43. function(success, error) {
  44. if (success) {
  45. init();
  46. } else {
  47. // Show obtain config error,
  48. // pass the error object for report
  49. APP.UI.messageHandler.openReportDialog(
  50. null, "dialog.connectError", error);
  51. }
  52. });
  53. } else {
  54. init();
  55. }
  56. }
  57. $(document).ready(function () {
  58. var URLProcessor = require("./modules/config/URLProcessor");
  59. URLProcessor.setConfigParametersFromUrl();
  60. APP.init();
  61. APP.translation.init();
  62. if(APP.API.isEnabled())
  63. APP.API.init();
  64. APP.UI.start(obtainConfigAndInit);
  65. });
  66. $(window).bind('beforeunload', function () {
  67. if(APP.API.isEnabled())
  68. APP.API.dispose();
  69. });
  70. module.exports = APP;