Skip to content

Commit e396123

Browse files
perf: defer script execution to improve page load performance
Added 'defer' attributes to multiple script tags to optimize page loading behavior. This change ensures scripts execute after HTML parsing completes, preventing render-blocking behavior and improving perceived load times. The defer strategy maintains functionality while enhancing user experience through better resource loading patterns, particularly beneficial for content-heavy pages and slower network connections.
1 parent 468e984 commit e396123

4 files changed

Lines changed: 8 additions & 14 deletions

File tree

Source/pages/Application.astro

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,8 @@ const Bundle = typeof process.env["Bundle"] !== "undefined";
181181
<Fragment>
182182
<script>
183183
import "@codeeditorland/Worker/Target/Worker/CSS/Load.js";
184-
</script>
185-
186-
<script>
187184
import "@codeeditorland/Worker/Target/Worker/Policy.js";
188-
</script>
189-
190-
<script>
191185
import "@codeeditorland/Worker/Target/Worker/Register.js";
192-
</script>
193-
194-
<script>
195186
import
196187
"@codeeditorland/output/Target/Microsoft/VSCode/vs/code/browser/workbench/workbench.js";
197188
</script>
@@ -203,6 +194,7 @@ const Bundle = typeof process.env["Bundle"] !== "undefined";
203194
type="module"
204195
src={Bust("/Worker/CSS/Load.js")}
205196
slot="Head"
197+
defer
206198
/>
207199

208200
<script
@@ -217,6 +209,7 @@ const Bundle = typeof process.env["Bundle"] !== "undefined";
217209
type="module"
218210
src={Bust("/Worker/Register.js")}
219211
slot="Head"
212+
defer
220213
/>
221214

222215
<script
@@ -225,6 +218,7 @@ const Bundle = typeof process.env["Bundle"] !== "undefined";
225218
src={Bust(
226219
"/Static/Application/vs/code/browser/workbench/workbench.js",
227220
)}
221+
defer
228222
/>
229223
</Fragment>
230224
)

Target/Application/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html class=no-js data-beasties-container dir=ltr lang=en><head><script type=module>document.documentElement.classList.remove("no-js"),document.documentElement.classList.add("js")</script><title></title><meta charset=utf-8><meta content name=description><meta content="width=device-width,initial-scale=1" name=viewport><meta content=#ffffff name=theme-color><meta content="telephone=no" name=format-detection><meta content=on name=twitter:dnt><meta data-settings={&#34;remoteAuthority&#34;:&#34;&#34;,&#34;serverBasePath&#34;:&#34;/&#34;,&#34;connectionToken&#34;:&#34;&#34;,&#34;enableWorkspaceTrust&#34;:true,&#34;settingsSyncOptions&#34;:{&#34;enabled&#34;:false},&#34;productConfiguration&#34;:{&#34;embedderIdentifier&#34;:&#34;desktop&#34;,&#34;nameShort&#34;:&#34;FIDDEE&#34;,&#34;nameLong&#34;:&#34;FIDDEE&#34;,&#34;applicationName&#34;:&#34;fiddee&#34;},&#34;developmentOptions&#34;:{&#34;logLevel&#34;:0,&#34;enableSmokeTestDriver&#34;:false}} id=vscode-workbench-web-configuration><link href=/Manifest.json rel=manifest crossorigin=use-credentials><script type=module>const Site="https://tauri.localhost/";globalThis._VSCODE_FILE_ROOT=`${Site}/Static/Application/`</script><script type=module>const Worker="/Worker.js?BASE_REMOTE=https%3A%2F%2Ftauri.localhost%2F&Time=1746432590430";window._WORKER=Worker</script><style>:root{--vscode-sash-size:4px;--vscode-sash-hover-size:4px}@property --chat-editing-last-edit-shift{syntax:"<percentage>";initial-value:100%;inherits:false}@property --inline-chat-frame-progress{syntax:"<percentage>";initial-value:0%;inherits:false}body{height:100%;width:100%;margin:0;padding:0;overflow:hidden;font-size:11px;user-select:none;-webkit-user-select:none}</style><link href=/_astro/Application.CRM72xFj.css rel=stylesheet media=print onload="this.media=&#34;all&#34;"><noscript><link href=/_astro/Application.CRM72xFj.css rel=stylesheet></noscript></head><body aria-label><script type=module src=/_astro/Application.astro_astro_type_script_index_0_lang.6Wq4vJ4r.js></script><script type=module>const e="string"==typeof window._WORKER?window._WORKER:"/Worker.js",r="WorkerReload";if("serviceWorker"in navigator){navigator.serviceWorker.addEventListener("controllerchange",(()=>{"true"===sessionStorage.getItem(r)&&(sessionStorage.removeItem(r),window.location.reload())})),navigator.serviceWorker.addEventListener("message",(e=>{"New"===e.data?.Version&&window.location.reload()}));const o=async()=>{const o=!!navigator.serviceWorker.controller;try{let t;if(window.trustedTypes)try{const r=window._POLICY_WORKER?.WorkerApplication;if(!r)throw new Error("Required Trusted Types policy 'WorkerApplication' not found. Ensure Policy.js executes first and succeeds.");t=r.createScriptURL(e)}catch(e){throw e}else t=e;const s=await navigator.serviceWorker.register(t,{scope:"/Application",type:"module"});s.installing||s.waiting||s.active,await navigator.serviceWorker.ready;const i=!!navigator.serviceWorker.controller;if(o||i)sessionStorage.getItem(r)&&sessionStorage.removeItem(r);else{if(!sessionStorage.getItem(r))return sessionStorage.setItem(r,"true"),void window.location.reload();sessionStorage.removeItem(r)}}catch(e){e instanceof TypeError&&(e.message.includes("TrustedScriptURL")||e.message.includes("Trusted Type")),sessionStorage.removeItem(r)}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",o):o()}</script><script type=module>(()=>{if(window._POLICY_WORKER=window._POLICY_WORKER||{},window.trustedTypes&&window.trustedTypes.createPolicy&&!window._POLICY_WORKER.WorkerApplication)try{window._POLICY_WORKER.WorkerApplication=window.trustedTypes.createPolicy("WorkerApplication",{createScriptURL:r=>{if(r&&/^\/[^/\\:]+\.js(\?.*)?$/.test(r))return r;throw new TypeError(`Invalid URL format for service worker script: ${r}`)}})}catch(r){r instanceof TypeError&&r.message.includes("already exists")}})()</script><script type=module>window._LOAD_CSS_WORKER=e=>{const t=e+(e.includes("?")?"&":"?")+"Skip=Intercept";try{if(document.querySelector(`link[href="${t}"]`))return;const e=document.createElement("link");e.rel="stylesheet",e.type="text/css",e.href=t,e.onerror=t=>{e.remove()},e.onload=()=>{},document.head.appendChild(e)}catch{}}</script></body></html>
1+
<!DOCTYPE html><html class=no-js data-beasties-container dir=ltr lang=en><head><script type=module>document.documentElement.classList.remove("no-js"),document.documentElement.classList.add("js")</script><title></title><meta charset=utf-8><meta content name=description><meta content="width=device-width,initial-scale=1" name=viewport><meta content=#ffffff name=theme-color><meta content="telephone=no" name=format-detection><meta content=on name=twitter:dnt><meta data-settings={&#34;remoteAuthority&#34;:&#34;&#34;,&#34;serverBasePath&#34;:&#34;/&#34;,&#34;connectionToken&#34;:&#34;&#34;,&#34;enableWorkspaceTrust&#34;:true,&#34;settingsSyncOptions&#34;:{&#34;enabled&#34;:false},&#34;productConfiguration&#34;:{&#34;embedderIdentifier&#34;:&#34;desktop&#34;,&#34;nameShort&#34;:&#34;FIDDEE&#34;,&#34;nameLong&#34;:&#34;FIDDEE&#34;,&#34;applicationName&#34;:&#34;fiddee&#34;},&#34;developmentOptions&#34;:{&#34;logLevel&#34;:0,&#34;enableSmokeTestDriver&#34;:false}} id=vscode-workbench-web-configuration><link href=/Manifest.json rel=manifest crossorigin=use-credentials><script type=module>const Site="https://tauri.localhost/";globalThis._VSCODE_FILE_ROOT=`${Site}/Static/Application/`</script><script type=module>const Worker="/Worker.js?BASE_REMOTE=https%3A%2F%2Ftauri.localhost%2F&Time=1746434949419";window._WORKER=Worker</script><style>:root{--vscode-sash-size:4px;--vscode-sash-hover-size:4px}@property --chat-editing-last-edit-shift{syntax:"<percentage>";initial-value:100%;inherits:false}@property --inline-chat-frame-progress{syntax:"<percentage>";initial-value:0%;inherits:false}body{height:100%;width:100%;margin:0;padding:0;overflow:hidden;font-size:11px;user-select:none;-webkit-user-select:none}</style><link href=/_astro/Application.CRM72xFj.css rel=stylesheet media=print onload="this.media=&#34;all&#34;"><noscript><link href=/_astro/Application.CRM72xFj.css rel=stylesheet></noscript></head><body aria-label><script type=module src=/_astro/Application.astro_astro_type_script_index_0_lang.D_QlNiAb.js></script></body></html>

Target/Worker.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Target/_astro/Application.astro_astro_type_script_index_0_lang.6Wq4vJ4r.js renamed to Target/_astro/Application.astro_astro_type_script_index_0_lang.D_QlNiAb.js

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)