Factor out reportWebVitals.ts

This commit is contained in:
Quantum 2023-07-15 17:57:34 -04:00
parent 766a222979
commit caa0a02a0a
4 changed files with 3 additions and 18 deletions

View file

@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
import 'bootstrap/js/dist/collapse'; import 'bootstrap/js/dist/collapse';
import './index.scss'; import './index.scss';
import App from './App'; import App from './App';
import reportWebVitals from './reportWebVitals'; import reportWebVitals from '@common/ui/reportWebVitals';
import {MobileTooltipProvider} from '@common/ui/MobileTooltip'; import {MobileTooltipProvider} from '@common/ui/MobileTooltip';
ReactDOM.render( ReactDOM.render(

View file

@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
import 'bootstrap/js/dist/collapse'; import 'bootstrap/js/dist/collapse';
import './index.scss'; import './index.scss';
import App from './App'; import App from './App';
import reportWebVitals from './reportWebVitals'; import reportWebVitals from '@common/ui/reportWebVitals';
import {MobileTooltipProvider} from '@common/ui/MobileTooltip'; import {MobileTooltipProvider} from '@common/ui/MobileTooltip';
ReactDOM.render( ReactDOM.render(

View file

@ -1,15 +0,0 @@
import { ReportHandler } from 'web-vitals';
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
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;