handle gateway connecting before page load
This commit is contained in:
parent
67f1b481ac
commit
fa6f65ce8a
1 changed files with 53 additions and 31 deletions
|
@ -12,9 +12,22 @@ import { timeline } from './timeline';
|
|||
|
||||
timeline.start();
|
||||
|
||||
let loaded = false;
|
||||
let loadedListener = null;
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
loaded = true;
|
||||
if (loadedListener) {
|
||||
loadedListener();
|
||||
loadedListener = null;
|
||||
}
|
||||
});
|
||||
|
||||
function handleGatewaySettlement() {
|
||||
timeline.addCheckpoint("Got gateway settlement");
|
||||
|
||||
const loadApplication = () => {
|
||||
timeline.addCheckpoint("Application load started");
|
||||
|
||||
const loadingElement = document.getElementById("pre--loading-screen");
|
||||
if (loadingElement) {
|
||||
loadingElement.parentElement.removeChild(loadingElement);
|
||||
|
@ -47,6 +60,15 @@ function handleGatewaySettlement() {
|
|||
|
||||
timeline.addCheckpoint("All initialization finished");
|
||||
timeline.dump();
|
||||
};
|
||||
|
||||
if (!loaded) {
|
||||
timeline.addCheckpoint("Waiting for DOM content before loading application");
|
||||
|
||||
loadedListener = loadApplication;
|
||||
} else {
|
||||
loadApplication();
|
||||
}
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
|
Loading…
Reference in a new issue