2016-12-14 10:32:36 +00:00
|
|
|
/* global APP */
|
2017-01-10 21:55:31 +00:00
|
|
|
|
2016-11-23 21:46:46 +00:00
|
|
|
import React from 'react';
|
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
|
2020-06-04 14:09:13 +00:00
|
|
|
import { App } from './features/app/components';
|
2019-08-21 14:50:00 +00:00
|
|
|
import { getLogger } from './features/base/logging/functions';
|
2018-05-07 09:36:02 +00:00
|
|
|
import { Platform } from './features/base/react';
|
2020-06-29 07:45:58 +00:00
|
|
|
import { getJitsiMeetGlobalNS } from './features/base/util';
|
2022-10-28 10:07:58 +00:00
|
|
|
import PrejoinApp from './features/prejoin/components/web/PrejoinApp';
|
2016-11-23 21:46:46 +00:00
|
|
|
|
2019-08-21 14:50:00 +00:00
|
|
|
const logger = getLogger('index.web');
|
2018-05-07 09:36:02 +00:00
|
|
|
const OS = Platform.OS;
|
2016-12-14 10:32:36 +00:00
|
|
|
|
|
|
|
/**
|
2017-01-10 21:55:31 +00:00
|
|
|
* Renders the app when the DOM tree has been loaded.
|
2016-12-14 10:32:36 +00:00
|
|
|
*/
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
|
|
const now = window.performance.now();
|
|
|
|
|
|
|
|
APP.connectionTimes['document.ready'] = now;
|
|
|
|
logger.log('(TIME) document ready:\t', now);
|
|
|
|
});
|
|
|
|
|
2018-05-07 09:36:02 +00:00
|
|
|
// Workaround for the issue when returning to a page with the back button and
|
|
|
|
// the page is loaded from the 'back-forward' cache on iOS which causes nothing
|
|
|
|
// to be rendered.
|
|
|
|
if (OS === 'ios') {
|
|
|
|
window.addEventListener('pageshow', event => {
|
|
|
|
// Detect pages loaded from the 'back-forward' cache
|
|
|
|
// (https://webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/)
|
|
|
|
if (event.persisted) {
|
|
|
|
// Maybe there is a more graceful approach but in the moment of
|
|
|
|
// writing nothing else resolves the issue. I tried to execute our
|
|
|
|
// DOMContentLoaded handler but it seems that the 'onpageshow' event
|
|
|
|
// is triggered only when 'window.location.reload()' code exists.
|
|
|
|
window.location.reload();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-06-29 07:45:58 +00:00
|
|
|
const globalNS = getJitsiMeetGlobalNS();
|
|
|
|
|
|
|
|
globalNS.entryPoints = {
|
|
|
|
APP: App,
|
|
|
|
PREJOIN: PrejoinApp
|
|
|
|
};
|
|
|
|
|
|
|
|
globalNS.renderEntryPoint = ({
|
|
|
|
Component,
|
|
|
|
props = {},
|
|
|
|
elementId = 'react'
|
|
|
|
}) => {
|
|
|
|
ReactDOM.render(
|
|
|
|
<Component { ...props } />,
|
|
|
|
document.getElementById(elementId)
|
|
|
|
);
|
|
|
|
};
|