[英]What is the web-vitals, comming with create-react-app?
I have just recognised that my newly created Reactjs application have a file src/reportWebVitals.js
, which is being called in index.js.我刚刚认识到我新创建的 Reactjs 应用程序有一个文件
src/reportWebVitals.js
,它在 index.js 中被调用。 What is this file/pice of code for?这个文件/代码的用途是什么?
const reportWebVitals = onPerfEntry => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;
It is a third-party library is used to capture and measure user experience metrics comming as a default with create-react-app
.它是一个第三方库,用于捕获和测量默认与
create-react-app
一起使用的用户体验指标。
The web-vitals library is a tiny (~1K), modular library for measuring all the Web Vitals metrics on real users, in a way that accurately matches how they're measured by Chrome and reported to other Google tools (eg Chrome User Experience Report, Page Speed Insights, Search Console's Speed Report).
web-vitals 库是一个小型(~1K)模块化库,用于测量真实用户的所有 Web Vitals 指标,其方式与 Chrome 测量这些指标并报告给其他 Google 工具(例如 Chrome 用户体验)的方式准确匹配报告、Page Speed Insights、Search Console 的速度报告)。
They are grouped under two title;它们分为两个标题;
for more detail -> https://github.com/GoogleChrome/web-vitals了解更多详情 -> https://github.com/GoogleChrome/web-vitals
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.