拦截重写js和css的加载过程
const appendChild=document.head.appendChild
document.head.appendChild=function(dom) {
if(dom.tagName==='SCRIPT'){
//加载js
LCache.loadAll(dom.src,onload)
}else if(dom.tagName==='LINK'){
//加载js
LCache.loadAll(dom.href,onload)
}else{
return appendChild.apply(document.head,arguments);
}
}
const dom=document.createElement('script')
dom.src='a.js';
document.head.appendChild(dom)

浙公网安备 33010602011771号