Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async ({ name: appName }) => {
await frameworkStartedDefer.promise;
// 获取入口 html 模板及脚本加载器
const { template: appContent, execScripts, assetPublicPath } = await importEntry(entry, { fetch });
// as single-spa load and bootstrap new app parallel with other apps unmounting
// (see https://github.com/CanopyTax/single-spa/blob/master/src/navigation/reroute.js#L74)
// we need wait to load the app until all apps are finishing unmount in singular mode
if (await validateSingularMode(singularMode, app)) {
await (prevAppUnmountedDeferred && prevAppUnmountedDeferred.promise);
}
// 第一次加载设置应用可见区域 dom 结构
// 确保每次应用加载前容器 dom 结构已经设置完毕
render({ appContent, loading: true });
let jsSandbox: Window = window;
let mountSandbox = () => Promise.resolve();
let unmountSandbox = () => Promise.resolve();
if (useJsSandbox) {
const sandbox = genSandbox(appName, assetPublicPath);
requestIdleCallback(async () => {
const { getExternalScripts, getExternalStyleSheets } = await importEntry(entry, { fetch });
requestIdleCallback(getExternalStyleSheets);
requestIdleCallback(getExternalScripts);
});
}