@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.
@@ -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.4";
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.4";
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
- if (!loadTime.isValid && perf) {
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
  }
@@ -11,7 +11,7 @@
11
11
  /**
12
12
  * Exposes the version of the agent
13
13
  */
14
- export const VERSION = "1.313.1-rc.4";
14
+ export const VERSION = "1.313.1-rc.5";
15
15
 
16
16
  /**
17
17
  * Exposes the build type of the agent
@@ -11,7 +11,7 @@
11
11
  /**
12
12
  * Exposes the version of the agent
13
13
  */
14
- export const VERSION = "1.313.1-rc.4";
14
+ export const VERSION = "1.313.1-rc.5";
15
15
 
16
16
  /**
17
17
  * Exposes the build type of the agent
@@ -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
- if (!loadTime.isValid && perf) {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.313.1-rc.4",
3
+ "version": "1.313.1-rc.5",
4
4
  "private": false,
5
5
  "author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
6
6
  "description": "New Relic Browser Agent",
@@ -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
- if (!loadTime.isValid && perf) {
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)