@newrelic/browser-agent 1.313.1-rc.4 → 1.313.1-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/vitals/load-time.js +5 -2
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/vitals/load-time.js +5 -2
- package/package.json +1 -1
- package/src/common/vitals/load-time.js +5 -2
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.RRWEB_PACKAGE_NAME = exports.D
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.313.1-rc.
|
|
20
|
+
const VERSION = exports.VERSION = "1.313.1-rc.5";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.RRWEB_PACKAGE_NAME = exports.D
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.313.1-rc.
|
|
20
|
+
const VERSION = exports.VERSION = "1.313.1-rc.5";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -17,12 +17,15 @@ const loadTime = exports.loadTime = new _vitalMetric.VitalMetric(_constants.VITA
|
|
|
17
17
|
if (_runtime.isBrowserScope) {
|
|
18
18
|
const perf = _runtime.globalScope.performance;
|
|
19
19
|
const handler = () => {
|
|
20
|
-
|
|
20
|
+
// setTimeout defers the read until after the load event handler returns,
|
|
21
|
+
// ensuring loadEventEnd is populated (non-zero) — matching the web-vitals onTTFB pattern
|
|
22
|
+
setTimeout(() => {
|
|
23
|
+
if (loadTime.isValid || !perf) return;
|
|
21
24
|
const navEntry = (0, _runtime.getNavigationEntry)();
|
|
22
25
|
loadTime.update({
|
|
23
26
|
value: navEntry ? navEntry.loadEventEnd : perf.timing?.loadEventEnd - _runtime.originTime
|
|
24
27
|
});
|
|
25
|
-
}
|
|
28
|
+
}, 0);
|
|
26
29
|
};
|
|
27
30
|
(0, _load.onWindowLoad)(handler, true);
|
|
28
31
|
}
|
|
@@ -10,12 +10,15 @@ export const loadTime = new VitalMetric(VITAL_NAMES.LOAD_TIME);
|
|
|
10
10
|
if (isBrowserScope) {
|
|
11
11
|
const perf = globalScope.performance;
|
|
12
12
|
const handler = () => {
|
|
13
|
-
|
|
13
|
+
// setTimeout defers the read until after the load event handler returns,
|
|
14
|
+
// ensuring loadEventEnd is populated (non-zero) — matching the web-vitals onTTFB pattern
|
|
15
|
+
setTimeout(() => {
|
|
16
|
+
if (loadTime.isValid || !perf) return;
|
|
14
17
|
const navEntry = getNavigationEntry();
|
|
15
18
|
loadTime.update({
|
|
16
19
|
value: navEntry ? navEntry.loadEventEnd : perf.timing?.loadEventEnd - originTime
|
|
17
20
|
});
|
|
18
|
-
}
|
|
21
|
+
}, 0);
|
|
19
22
|
};
|
|
20
23
|
onWindowLoad(handler, true);
|
|
21
24
|
}
|
package/package.json
CHANGED
|
@@ -12,12 +12,15 @@ export const loadTime = new VitalMetric(VITAL_NAMES.LOAD_TIME)
|
|
|
12
12
|
if (isBrowserScope) {
|
|
13
13
|
const perf = globalScope.performance
|
|
14
14
|
const handler = () => {
|
|
15
|
-
|
|
15
|
+
// setTimeout defers the read until after the load event handler returns,
|
|
16
|
+
// ensuring loadEventEnd is populated (non-zero) — matching the web-vitals onTTFB pattern
|
|
17
|
+
setTimeout(() => {
|
|
18
|
+
if (loadTime.isValid || !perf) return
|
|
16
19
|
const navEntry = getNavigationEntry()
|
|
17
20
|
loadTime.update({
|
|
18
21
|
value: navEntry ? navEntry.loadEventEnd : (perf.timing?.loadEventEnd - originTime)
|
|
19
22
|
})
|
|
20
|
-
}
|
|
23
|
+
}, 0)
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
onWindowLoad(handler, true)
|