Browse Source

feat(window.loaded): Add new metric. (#14965)

factor2
Hristo Terezov 10 months ago
parent
commit
4d79bbb5d8
No account linked to committer's email address
2 changed files with 9 additions and 0 deletions
  1. 5
    0
      index.html
  2. 4
    0
      react/index.web.js

+ 5
- 0
index.html View File

@@ -69,6 +69,11 @@
69 69
 
70 70
         window.indexLoadedTime = window.performance.now();
71 71
         console.log("(TIME) index.html loaded:\t", indexLoadedTime);
72
+        window.addEventListener('load', function() {
73
+            window.loadedEventTime = window.performance.now();
74
+            console.log("(TIME) window loaded event:\t", loadedEventTime);
75
+        });
76
+
72 77
         // XXX the code below listeners for errors and displays an error message
73 78
         // in the document body when any of the required files fails to load.
74 79
         // The intention is to prevent from displaying broken page.

+ 4
- 0
react/index.web.js View File

@@ -51,6 +51,10 @@ globalNS.connectionTimes = {
51 51
     'index.loaded': window.indexLoadedTime
52 52
 };
53 53
 
54
+window.addEventListener('load', () => {
55
+    globalNS.connectionTimes['window.loaded'] = window.loadedEventTime;
56
+});
57
+
54 58
 document.addEventListener('DOMContentLoaded', () => {
55 59
     const now = window.performance.now();
56 60
 

Loading…
Cancel
Save