示例工程 01-orientation

01-orientation/02-script-loading/defer-script.js

javascript · 0.2 KB

运行:01 · 四种脚本加载方式

点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。

// defer 脚本:解析完成后才执行,此时 document.readyState 已不是 "loading"
window.__rec('defer', {
  bodyComplete: document.readyState !== 'loading',
  afterMarkerExists: !!document.getElementById('after-classic')
});