瀏覽代碼

Don't call successBeforeContentLoaded(head) redundantly

Jamie Birch 5 年之前
父節點
當前提交
fb6d351352
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5
    4
      example/examples/Injection.tsx

+ 5
- 4
example/examples/Injection.tsx 查看文件

65
 
65
 
66
               if(head){
66
               if(head){
67
                 declareSuccessBeforeContentLoaded(head);
67
                 declareSuccessBeforeContentLoaded(head);
68
+              } else {
69
+                window.self.document.addEventListener("DOMContentLoaded", function (event) {
70
+                  const head = (window.self.document.head || window.self.document.getElementsByTagName('head')[0]);
71
+                  declareSuccessBeforeContentLoaded(head);
72
+                });
68
               }
73
               }
69
 
74
 
70
-              window.self.document.addEventListener("DOMContentLoaded", function (event) {
71
-                const head = (window.self.document.head || window.self.document.getElementsByTagName('head')[0]);
72
-                declareSuccessBeforeContentLoaded(head);
73
-              });
74
               `}
75
               `}
75
               
76
               
76
               injectedJavaScriptForMainFrameOnly={false}
77
               injectedJavaScriptForMainFrameOnly={false}