From 60a3e0c5644ace3fadd88474c3b11c4193ebdbb3 Mon Sep 17 00:00:00 2001 From: yiludege Date: Fri, 23 Sep 2022 23:19:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dasync=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E5=AF=BC=E8=87=B4=E8=84=9A=E6=9C=AC=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E9=94=99=E4=B9=B1=E9=97=AE=E9=A2=98=20(#173)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close #173 --- docs/api/preloadApp.md | 2 ++ docs/api/startApp.md | 2 ++ packages/wujie-core/src/iframe.ts | 7 ++++--- packages/wujie-core/src/index.ts | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/api/preloadApp.md b/docs/api/preloadApp.md index 1800e1a40..56bf77b0d 100644 --- a/docs/api/preloadApp.md +++ b/docs/api/preloadApp.md @@ -177,6 +177,8 @@ interface ScriptObjectLoader { src?: string; /** 脚本是否为module模块 */ module?: boolean; + /** 脚本是否为async执行 */ + async?: boolean; /** 脚本是否设置crossorigin */ crossorigin?: boolean; /** 脚本crossorigin的类型 */ diff --git a/docs/api/startApp.md b/docs/api/startApp.md index eaea4e800..a9ecdb426 100644 --- a/docs/api/startApp.md +++ b/docs/api/startApp.md @@ -206,6 +206,8 @@ interface ScriptObjectLoader { src?: string; /** 脚本是否为module模块 */ module?: boolean; + /** 脚本是否为async执行 */ + async?: boolean; /** 脚本是否设置crossorigin */ crossorigin?: boolean; /** 脚本crossorigin的类型 */ diff --git a/packages/wujie-core/src/iframe.ts b/packages/wujie-core/src/iframe.ts index d698a1d70..9e9a68ba4 100644 --- a/packages/wujie-core/src/iframe.ts +++ b/packages/wujie-core/src/iframe.ts @@ -650,7 +650,7 @@ export function syncIframeUrlToWindow(iframeWindow: Window): void { * @param iframeWindow */ export function insertScriptToIframe(scriptResult: ScriptObject | ScriptObjectLoader, iframeWindow: Window) { - const { src, module, content, crossorigin, crossoriginType, callback } = scriptResult as ScriptObjectLoader; + const { src, module, content, crossorigin, crossoriginType, async, callback } = scriptResult as ScriptObjectLoader; const scriptElement = iframeWindow.document.createElement("script"); const nextScriptElement = iframeWindow.document.createElement("script"); const { replace, plugins, proxyLocation } = iframeWindow.__WUJIE; @@ -686,14 +686,15 @@ export function insertScriptToIframe(scriptResult: ScriptObject | ScriptObjectLo if (/^