Skip to content

Commit

Permalink
updated web vitals package
Browse files Browse the repository at this point in the history
  • Loading branch information
ttomasz committed Sep 18, 2023
1 parent 927aee9 commit a134c9e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 23 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"react-select": "^5.7.0",
"store": "^2.0.12",
"typescript": "^4.8.3",
"web-vitals": "^2.1.4"
"web-vitals": "^3.4.0"
},
"scripts": {
"start": "cross-env BROWSER=none react-scripts start",
Expand Down Expand Up @@ -63,6 +63,14 @@
},
"devDependencies": {
"@beyondtracks/spritezero-cli": "^2.3.1",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.2.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^29.0.3",
"@types/node": "^18.7.18",
"@types/react": "^18.0.20",
"@types/react-dom": "^18.0.6",
"@types/react-image-gallery": "^1.2.0",
"@types/store": "^2.0.2",
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.40.0",
Expand All @@ -72,14 +80,6 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.31.10",
"eslint-plugin-react-hooks": "^4.6.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.2.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^29.0.3",
"@types/node": "^18.7.18",
"@types/react": "^18.0.20",
"@types/react-dom": "^18.0.6",
"@types/react-image-gallery": "^1.2.0"
"eslint-plugin-react-hooks": "^4.6.0"
}
}
3 changes: 3 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ import ReactDOM from "react-dom/client";
import "./index.css";
import Main from "./Main";
import "./i18n";
import reportWebVitals from "./reportWebVitals";

const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement);
root.render(
<React.StrictMode>
<Main />
</React.StrictMode>,
);

reportWebVitals(console.log);
12 changes: 6 additions & 6 deletions src/reportWebVitals.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const reportWebVitals = (onPerfEntry: any) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import("web-vitals").then(({
getCLS, getFID, getFCP, getLCP, getTTFB,
onCLS, onFID, onFCP, onLCP, onTTFB,
}) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
onCLS(onPerfEntry);
onFID(onPerfEntry);
onFCP(onPerfEntry);
onLCP(onPerfEntry);
onTTFB(onPerfEntry);
});
}
};
Expand Down

0 comments on commit a134c9e

Please sign in to comment.