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.

index.web.js 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import { App } from './features/app/components/App.web';
  4. import { getLogger } from './features/base/logging/functions';
  5. import Platform from './features/base/react/Platform.web';
  6. import { getJitsiMeetGlobalNS } from './features/base/util/helpers';
  7. import DialInSummaryApp from './features/invite/components/dial-in-summary/web/DialInSummaryApp';
  8. import PrejoinApp from './features/prejoin/components/web/PrejoinApp';
  9. const logger = getLogger('index.web');
  10. const OS = Platform.OS;
  11. // Workaround for the issue when returning to a page with the back button and
  12. // the page is loaded from the 'back-forward' cache on iOS which causes nothing
  13. // to be rendered.
  14. if (OS === 'ios') {
  15. window.addEventListener('pageshow', event => {
  16. // Detect pages loaded from the 'back-forward' cache
  17. // (https://webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/)
  18. if (event.persisted) {
  19. // Maybe there is a more graceful approach but in the moment of
  20. // writing nothing else resolves the issue. I tried to execute our
  21. // DOMContentLoaded handler but it seems that the 'onpageshow' event
  22. // is triggered only when 'window.location.reload()' code exists.
  23. window.location.reload();
  24. }
  25. });
  26. }
  27. const globalNS = getJitsiMeetGlobalNS();
  28. // Used for automated performance tests.
  29. globalNS.connectionTimes = {
  30. 'index.loaded': window.indexLoadedTime
  31. };
  32. document.addEventListener('DOMContentLoaded', () => {
  33. const now = window.performance.now();
  34. globalNS.connectionTimes['document.ready'] = now;
  35. logger.log('(TIME) document ready:\t', now);
  36. });
  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. };