嵌套的window.addEventListener不起作用

时间:2020-02-24 17:08:19

标签: javascript jquery

这为什么起作用...

window.addEventListener('load', function (){
    alert('Function #1');
});

window.addEventListener('load', function (){
    alert('Function #2');
});

...这不是吗?

window.addEventListener('load', function (){
    alert('Function #1');
    window.addEventListener('load', function (){
        alert('Function #2');
    });
});

我正在寻找一种加载(jQuery get)和异步呈现信息的方法。 例如

get(resource_1)
check if resource_1 has been fetched with interval, then render resource_1

 if resource_1 has been rendered
   get(resource_2)
   check if resource_2 has been fetched with interval, then render resource_2

   if resource_2 has been rendered
     get(resource_3)
     check if resource_3 has been fetched with interval, then render resource_3

     ...

0 个答案:

没有答案