@adobe/helix-rum-enhancer
Advanced tools
Comparing version 1.11.0 to 1.11.1
@@ -0,1 +1,8 @@ | ||
## [1.11.1](https://github.com/adobe/helix-rum-enhancer/compare/v1.11.0...v1.11.1) (2024-02-28) | ||
### Bug Fixes | ||
* **cwv:** report metrics eagerly ([b7a7e3e](https://github.com/adobe/helix-rum-enhancer/commit/b7a7e3e202f8dc4de97994cdf36ece95075082c4)) | ||
# [1.11.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.10.0...v1.11.0) (2024-01-17) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@adobe/helix-rum-enhancer", | ||
"version": "1.11.0", | ||
"version": "1.11.1", | ||
"description": "Helix RUM Enhancer", | ||
@@ -12,2 +12,3 @@ "main": "src/index.js", | ||
"semantic-release": "semantic-release", | ||
"semantic-release-dry": "semantic-release --dry-run --branches $CI_BRANCH 1.x main", | ||
"prepare": "husky install" | ||
@@ -32,3 +33,3 @@ }, | ||
"devDependencies": { | ||
"@adobe/eslint-config-helix": "2.0.5", | ||
"@adobe/eslint-config-helix": "2.0.6", | ||
"@semantic-release/changelog": "6.0.3", | ||
@@ -35,0 +36,0 @@ "@semantic-release/git": "10.0.1", |
@@ -7,6 +7,5 @@ # Helix RUM Enhancer | ||
[![codecov](https://img.shields.io/codecov/c/github/adobe/helix-rum-enhancer.svg)](https://codecov.io/gh/adobe/helix-rum-enhancer) | ||
[![CircleCI](https://img.shields.io/circleci/project/github/adobe/helix-rum-enhancer.svg)](https://circleci.com/gh/adobe/helix-rum-enhancer) | ||
[![GitHub Actions](https://img.shields.io/github/actions/workflow/status/adobe/helix-rum-enhancer/main.yaml)](https://github.com/adobe/helix-rum-enhancer/actions/workflows/main.yaml) | ||
[![GitHub license](https://img.shields.io/github/license/adobe/helix-rum-enhancer.svg)](https://github.com/adobe/helix-rum-enhancer/blob/master/LICENSE.txt) | ||
[![GitHub issues](https://img.shields.io/github/issues/adobe/helix-rum-enhancer.svg)](https://github.com/adobe/helix-rum-enhancer/issues) | ||
[![LGTM Code Quality Grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/adobe/helix-rum-enhancer.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/adobe/helix-rum-enhancer) | ||
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) | ||
@@ -13,0 +12,0 @@ |
@@ -94,10 +94,15 @@ /* | ||
}; | ||
const featureToggle = () => window.location.hostname === 'blog.adobe.com'; | ||
const isEager = (metric) => ['CLS', 'LCP'].includes(metric); | ||
// When loading `web-vitals` using a classic script, all the public | ||
// methods can be found on the `webVitals` global namespace. | ||
['CLS', 'FID', 'LCP', 'INP', 'TTFB'] | ||
.map((metric) => window.webVitals[`get${metric}`]) | ||
.filter((metric) => typeof metric === 'function') | ||
.forEach((invokeMetric) => { | ||
invokeMetric(storeCWV); | ||
}); | ||
['FID', 'INP', 'TTFB', 'CLS', 'LCP'].forEach((metric) => { | ||
const metricFn = window.webVitals[`on${metric}`]; | ||
if (typeof metricFn === 'function') { | ||
const opts = isEager(metric) ? { reportAllChanges: featureToggle() } : undefined; | ||
metricFn(storeCWV, opts); | ||
} | ||
}); | ||
}; | ||
@@ -104,0 +109,0 @@ document.head.appendChild(script); |
Sorry, the diff of this file is not supported yet
39147
215
43