impart-client / jsReloader.js
P01yH3dr0n's picture
Update jsReloader.js
bc7cbda verified
raw
history blame
354 Bytes
window.addEventListener("error", e => {
const tag = e.target
if (tag.tagName === 'SCRIPT' && !(e instanceof ErrorEvent)) {
console.log("JS 加载错误")
const url=new URL(tag.src)
document.write(`<script src="${url.toString()}">\<\/script>`);
}
}, true);
window.onload = function () {
setTimeout(run(), 10000);
};