📜  yogesh joshi 之后的 javascript 函数加载 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:22.259000             🧑  作者: Mango

代码示例1
document.addEventListener('readystatechange', event => { 

    // When HTML/DOM elements are ready:
    if (event.target.readyState === "interactive") {   //does same as:  ..addEventListener("DOMContentLoaded"..
        alert("hi 1");
    }

    // When window loaded ( external resources are loaded too- `css`,`src`, etc...) 
    if (event.target.readyState === "complete") {
        alert("hi 2");
    }
});