Skip to content

Commit bb38169

Browse files
authored
Check if serverTiming is defined before gathering its metrics. (#2301)
1 parent c8fe4c4 commit bb38169

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
(function () {
22
let t = window.performance.getEntriesByType('navigation')[0];
33
const serverTimings = [];
4-
for (let timing of t.serverTiming) {
5-
serverTimings.push({
6-
name: timing.name,
7-
duration: timing.duration,
8-
description: timing.description
9-
});
4+
if (t.serverTiming) {
5+
for (let timing of t.serverTiming) {
6+
serverTimings.push({
7+
name: timing.name,
8+
duration: timing.duration,
9+
description: timing.description
10+
});
11+
}
1012
}
1113
return serverTimings;
1214
})();

0 commit comments

Comments
 (0)