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 3.0KB

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