Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

index.web.js 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. // Add global loggers.
  11. window.addEventListener('error', ev => {
  12. logger.error(
  13. `UnhandledError: ${ev.message}`,
  14. `Script: ${ev.filename}`,
  15. `Line: ${ev.lineno}`,
  16. `Column: ${ev.colno}`,
  17. 'StackTrace: ', ev.error?.stack);
  18. });
  19. window.addEventListener('unhandledrejection', ev => {
  20. logger.error(
  21. `UnhandledPromiseRejection: ${ev.reason}`,
  22. 'StackTrace: ', ev.reason?.stack);
  23. });
  24. // Workaround for the issue when returning to a page with the back button and
  25. // the page is loaded from the 'back-forward' cache on iOS which causes nothing
  26. // to be rendered.
  27. if (Platform.OS === 'ios') {
  28. window.addEventListener('pageshow', event => {
  29. // Detect pages loaded from the 'back-forward' cache
  30. // (https://webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/)
  31. if (event.persisted) {
  32. // Maybe there is a more graceful approach but in the moment of
  33. // writing nothing else resolves the issue. I tried to execute our
  34. // DOMContentLoaded handler but it seems that the 'onpageshow' event
  35. // is triggered only when 'window.location.reload()' code exists.
  36. window.location.reload();
  37. }
  38. });
  39. }
  40. const globalNS = getJitsiMeetGlobalNS();
  41. // Used for automated performance tests.
  42. globalNS.connectionTimes = {
  43. 'index.loaded': window.indexLoadedTime
  44. };
  45. document.addEventListener('DOMContentLoaded', () => {
  46. const now = window.performance.now();
  47. globalNS.connectionTimes['document.ready'] = now;
  48. logger.log('(TIME) document ready:\t', now);
  49. });
  50. globalNS.entryPoints = {
  51. APP: App,
  52. PREJOIN: PrejoinApp,
  53. DIALIN: DialInSummaryApp
  54. };
  55. globalNS.renderEntryPoint = ({
  56. Component,
  57. props = {},
  58. elementId = 'react'
  59. }) => {
  60. ReactDOM.render(
  61. <Component { ...props } />,
  62. document.getElementById(elementId)
  63. );
  64. };