ui: add polyfill

This commit is contained in:
undefined committed 2024-06-27 15:40:21 +08:00
1 parent 2a8e3142b3
commit 67307ca48d
7 files changed
+48 -39

No files matched your search

+5 -9
View File
@@ -1,3 +1,5 @@
import './polyfill';
import * as Sentry from '@sentry/browser';
import $ from 'jquery';
@@ -57,16 +59,10 @@ const PageLoader = '<div class="page-loader nojs--hide" style="display:none;"><d
$('body').prepend(PageLoader);
$('.page-loader').fadeIn(500);
const prefetch = Promise.all([
fetch(`/constant/${UiContext.constantVersion}.js`).then((r) => r.text()),
import('./api'),
]);
document.addEventListener('DOMContentLoaded', async () => {
Object.assign(window.UiContext, JSON.parse(window.UiContextNew));
Object.assign(window.UserContext, JSON.parse(window.UserContextNew));
const [data, HydroExports] = await prefetch;
Object.assign(window, { HydroExports });
eval(data); // eslint-disable-line no-eval
await HydroExports.initPageLoader();
window.HydroExports = await import('./api');
await window._hydroLoad();
await window.HydroExports.initPageLoader();
}, false);