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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* global APP */
  2. import React from 'react';
  3. import ReactDOM from 'react-dom';
  4. import { App } from './features/app/components';
  5. import { getLogger } from './features/base/logging/functions';
  6. import { Platform } from './features/base/react';
  7. import { getJitsiMeetGlobalNS } from './features/base/util';
  8. import DialInSummaryApp from './features/invite/components/dial-in-summary/web/DialInSummaryApp';
  9. import PrejoinApp from './features/prejoin/components/web/PrejoinApp';
  10. const logger = getLogger('index.web');
  11. const OS = Platform.OS;
  12. /**
  13. * Renders the app when the DOM tree has been loaded.
  14. */
  15. document.addEventListener('DOMContentLoaded', () => {
  16. const now = window.performance.now();
  17. APP.connectionTimes['document.ready'] = now;
  18. logger.log('(TIME) document ready:\t', now);
  19. });
  20. // Workaround for the issue when returning to a page with the back button and
  21. // the page is loaded from the 'back-forward' cache on iOS which causes nothing
  22. // to be rendered.
  23. if (OS === 'ios') {
  24. window.addEventListener('pageshow', event => {
  25. // Detect pages loaded from the 'back-forward' cache
  26. // (https://webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/)
  27. if (event.persisted) {
  28. // Maybe there is a more graceful approach but in the moment of
  29. // writing nothing else resolves the issue. I tried to execute our
  30. // DOMContentLoaded handler but it seems that the 'onpageshow' event
  31. // is triggered only when 'window.location.reload()' code exists.
  32. window.location.reload();
  33. }
  34. });
  35. }
  36. const globalNS = getJitsiMeetGlobalNS();
  37. globalNS.entryPoints = {
  38. APP: App,
  39. PREJOIN: PrejoinApp,
  40. DIALIN: DialInSummaryApp
  41. };
  42. globalNS.renderEntryPoint = ({
  43. Component,
  44. props = {},
  45. elementId = 'react'
  46. }) => {
  47. ReactDOM.render(
  48. <Component { ...props } />,
  49. document.getElementById(elementId)
  50. );
  51. };