@ldelia/react-media 0.2.8 → 0.4.0
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.
- package/.storybook/main.js +25 -2
- package/README.md +1 -4
- package/config/env.js +104 -0
- package/config/getHttpsConfig.js +66 -0
- package/config/jest/babelTransform.js +29 -0
- package/config/jest/cssTransform.js +14 -0
- package/config/jest/fileTransform.js +40 -0
- package/config/modules.js +134 -0
- package/config/paths.js +77 -0
- package/config/webpack/persistentCache/createEnvironmentHash.js +9 -0
- package/config/webpack.config.js +755 -0
- package/config/webpackDevServer.config.js +127 -0
- package/dist/stories/timeline.stories.d.ts +6 -6
- package/package.json +127 -18
- package/scripts/build.js +217 -0
- package/scripts/start.js +154 -0
- package/scripts/test.js +52 -0
- package/src/components/__tests__/timeline/timeline.test.js +22 -0
- package/src/components/index.js +1 -0
- package/src/components/reproduction-widget/README.md +27 -0
- package/src/components/reproduction-widget/ReproductionWidget.js +29 -0
- package/src/components/reproduction-widget/ReproductionWidget.tsx +68 -0
- package/src/components/reproduction-widget/index.js +1 -0
- package/src/components/reproduction-widget/index.tsx +1 -0
- package/src/components/reproduction-widget/inner-players/PlayAlongInnerPlayer.js +5 -0
- package/src/components/reproduction-widget/inner-players/PlayAlongInnerPlayer.tsx +10 -0
- package/src/components/reproduction-widget/inner-players/YouTubeInnerPlayer.js +21 -0
- package/src/components/reproduction-widget/inner-players/YouTubeInnerPlayer.tsx +36 -0
- package/src/components/reproduction-widget/models/Player/PlayAlongPlayer.js +97 -0
- package/src/components/reproduction-widget/models/Player/PlayAlongPlayer.ts +129 -0
- package/src/components/reproduction-widget/models/Player/PlayerEvents.js +4 -0
- package/src/components/reproduction-widget/models/Player/PlayerEvents.ts +4 -0
- package/src/components/reproduction-widget/models/Player/YouTubePlayer.js +126 -0
- package/src/components/reproduction-widget/models/Player/YouTubePlayer.ts +171 -0
- package/src/components/reproduction-widget/models/Reproduction.js +214 -0
- package/src/components/reproduction-widget/models/Reproduction.ts +272 -0
- package/src/components/reproduction-widget/models/ReproductionBuilder.js +51 -0
- package/src/components/reproduction-widget/models/ReproductionBuilder.ts +70 -0
- package/{dist/components/timeline → src/components/timeline/RangeSelectorCanvas}/RangeSelectorCanvas.js +16 -22
- package/src/components/timeline/Timeline.js +77 -0
- package/src/components/timeline/TimelineCanvas/TickTime.js +26 -0
- package/src/components/timeline/TimelineCanvas/TickTimeCollectionDisplay.js +19 -0
- package/src/components/timeline/TimelineCanvas/TimelineCanvas.js +44 -0
- package/src/components/timeline/TimelineCanvas/drawTimeBlocksOnCanvas.js +28 -0
- package/src/components/timeline/TimelineValue/TimelineValue.js +50 -0
- package/src/components/timeline/ZoomContext/ZoomContext.js +2 -0
- package/src/components/timeline/constants.js +13 -0
- package/src/components/timeline/index.js +1 -0
- package/src/components/timeline/utils/utils.js +28 -0
- package/src/index.js +1 -0
- package/src/react-app-env.d.ts +71 -1
- package/src/react-docgen-types.d.ts +37 -0
- package/src/setupTests.js +5 -0
- package/src/stories/reproduction-widget.stories.js +16 -0
- package/src/stories/reproduction-widget.stories.tsx +23 -0
- package/src/stories/timeline.stories.js +54 -0
- package/storybook-static/favicon.svg +1 -0
- package/storybook-static/index.html +173 -0
- package/storybook-static/index.json +1 -0
- package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/project.json +1 -0
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +12 -0
- package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +412 -0
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/links-1/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/links-1/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +3 -0
- package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-common-assets/favicon.svg +1 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/globals-module-info.js +995 -0
- package/storybook-static/sb-manager/globals-runtime.js +53527 -0
- package/storybook-static/sb-manager/globals.js +48 -0
- package/storybook-static/sb-manager/runtime.js +11885 -0
- package/storybook-static/sb-preview/globals.js +33 -0
- package/storybook-static/sb-preview/runtime.js +9483 -0
- package/tsconfig.json +8 -7
- package/.storybook/main.ts +0 -18
- package/.storybook/preview.ts +0 -14
- package/dist/components/timeline/RangeSelectorCanvas.d.ts +0 -8
- package/dist/components/timeline/TickTime.d.ts +0 -7
- package/dist/components/timeline/TickTime.js +0 -31
- package/dist/components/timeline/TickTimeCollectionDisplay.d.ts +0 -6
- package/dist/components/timeline/TickTimeCollectionDisplay.js +0 -24
- package/dist/components/timeline/VaLueLineCanvas.d.ts +0 -7
- package/dist/components/timeline/VaLueLineCanvas.js +0 -111
- package/dist/reportWebVitals.d.ts +0 -3
- package/dist/reportWebVitals.js +0 -37
- package/src/reportWebVitals.ts +0 -15
package/tsconfig.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ES6",
|
|
4
|
-
"module": "
|
|
5
|
-
"declaration": true,
|
|
6
|
-
"outDir": "./dist",
|
|
7
|
-
"strict": true,
|
|
4
|
+
"module": "ESNext",
|
|
8
5
|
"jsx": "react",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"moduleResolution": "node",
|
|
9
8
|
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"allowSyntheticDefaultImports": true
|
|
11
12
|
},
|
|
12
|
-
"include": ["src"]
|
|
13
|
-
}
|
|
13
|
+
"include": ["src", ".storybook", "src/react-docgen-types.d.ts"]
|
|
14
|
+
}
|
package/.storybook/main.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { StorybookConfig } from "@storybook/react-webpack5";
|
|
2
|
-
|
|
3
|
-
const config: StorybookConfig = {
|
|
4
|
-
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
5
|
-
addons: [
|
|
6
|
-
"@storybook/preset-create-react-app",
|
|
7
|
-
"@storybook/addon-onboarding",
|
|
8
|
-
"@storybook/addon-links",
|
|
9
|
-
"@storybook/addon-essentials",
|
|
10
|
-
"@chromatic-com/storybook",
|
|
11
|
-
"@storybook/addon-interactions",
|
|
12
|
-
],
|
|
13
|
-
framework: {
|
|
14
|
-
name: "@storybook/react-webpack5",
|
|
15
|
-
options: {},
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
export default config;
|
package/.storybook/preview.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface RangeSelectorCanvasProps {
|
|
3
|
-
selectedRange: number[];
|
|
4
|
-
onChange: (value: number) => void;
|
|
5
|
-
onRangeChange: (value: number[]) => void;
|
|
6
|
-
}
|
|
7
|
-
declare const _default: React.NamedExoticComponent<RangeSelectorCanvasProps>;
|
|
8
|
-
export default _default;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
-
const TickTimeContainer = styled_components_1.default.span.attrs((props) => ({
|
|
9
|
-
style: {
|
|
10
|
-
left: props.left,
|
|
11
|
-
},
|
|
12
|
-
})) `
|
|
13
|
-
background: transparent;
|
|
14
|
-
position: absolute;
|
|
15
|
-
padding-left: 8px;
|
|
16
|
-
color: #646464;
|
|
17
|
-
user-select: none;
|
|
18
|
-
min-width: 20px;
|
|
19
|
-
max-width: 20px;
|
|
20
|
-
align-self: flex-end;
|
|
21
|
-
`;
|
|
22
|
-
const TickTime = ({ start, leftPosition }) => {
|
|
23
|
-
const minutes = Math.floor(start / 60);
|
|
24
|
-
let seconds = start - minutes * 60;
|
|
25
|
-
let secondsFormatted = seconds < 10 ? '0' + seconds : seconds.toString();
|
|
26
|
-
return (react_1.default.createElement(TickTimeContainer, { left: leftPosition, className: 'media-timeline-tick-time' },
|
|
27
|
-
minutes,
|
|
28
|
-
":",
|
|
29
|
-
secondsFormatted));
|
|
30
|
-
};
|
|
31
|
-
exports.default = TickTime;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
-
const TickTime_1 = __importDefault(require("./TickTime"));
|
|
9
|
-
const index_1 = require("./index");
|
|
10
|
-
const TickTimeCollectionDisplayContainer = styled_components_1.default.div `
|
|
11
|
-
position: absolute;
|
|
12
|
-
display: flex;
|
|
13
|
-
align-self: flex-end;
|
|
14
|
-
height: 100%;
|
|
15
|
-
`;
|
|
16
|
-
const TickTimeCollectionDisplay = ({ tickTimes = [], }) => {
|
|
17
|
-
return (react_1.default.createElement(index_1.ZoomContext.Consumer, null, (value) => {
|
|
18
|
-
return (react_1.default.createElement(TickTimeCollectionDisplayContainer, null, tickTimes.map((tickTimeValue, index) => {
|
|
19
|
-
const leftPosition = tickTimeValue * value.pixelsInSecond + 'px';
|
|
20
|
-
return (react_1.default.createElement(TickTime_1.default, { key: index, start: tickTimeValue, leftPosition: leftPosition }));
|
|
21
|
-
})));
|
|
22
|
-
}));
|
|
23
|
-
};
|
|
24
|
-
exports.default = TickTimeCollectionDisplay;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const react_1 = __importStar(require("react"));
|
|
30
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
31
|
-
const index_1 = require("./index");
|
|
32
|
-
const utils_1 = require("./utils/utils");
|
|
33
|
-
const OverlayCanvas = styled_components_1.default.canvas `
|
|
34
|
-
position: absolute;
|
|
35
|
-
top: 0;
|
|
36
|
-
left: 0;
|
|
37
|
-
width: 100%;
|
|
38
|
-
height: 100%;
|
|
39
|
-
color: #c9c9c9;
|
|
40
|
-
`;
|
|
41
|
-
const PreValueLine = styled_components_1.default.span `
|
|
42
|
-
position: absolute;
|
|
43
|
-
left: 0;
|
|
44
|
-
height: 100%;
|
|
45
|
-
`;
|
|
46
|
-
const ValueLine = styled_components_1.default.span `
|
|
47
|
-
position: absolute;
|
|
48
|
-
width: 1px;
|
|
49
|
-
height: 100%;
|
|
50
|
-
background-color: #575757;
|
|
51
|
-
`;
|
|
52
|
-
const PostValueLine = styled_components_1.default.span `
|
|
53
|
-
position: absolute;
|
|
54
|
-
height: 100%;
|
|
55
|
-
`;
|
|
56
|
-
const VaLueLineCanvas = ({ blockStartingTimes = [], value, }) => {
|
|
57
|
-
const canvasRef = (0, react_1.useRef)(null);
|
|
58
|
-
const preValueLineRef = (0, react_1.useRef)(null);
|
|
59
|
-
const valueLineRef = (0, react_1.useRef)(null);
|
|
60
|
-
const postValueLineRef = (0, react_1.useRef)(null);
|
|
61
|
-
const zoomContextValue = (0, react_1.useContext)(index_1.ZoomContext);
|
|
62
|
-
const showBlocks = (0, react_1.useCallback)((canvas) => {
|
|
63
|
-
const blockHeight = 20;
|
|
64
|
-
const context = canvas.getContext('2d');
|
|
65
|
-
for (const blockStartingTime of blockStartingTimes) {
|
|
66
|
-
const x0Pixel = (0, utils_1.secondsToPixel)(zoomContextValue, blockStartingTime);
|
|
67
|
-
const x1Pixel = (0, utils_1.secondsToPixel)(zoomContextValue, blockStartingTime + zoomContextValue.blockOffset);
|
|
68
|
-
context.beginPath();
|
|
69
|
-
context.moveTo(x0Pixel, canvas.height);
|
|
70
|
-
context.lineTo(x0Pixel, canvas.height - blockHeight);
|
|
71
|
-
context.lineTo(x1Pixel, canvas.height - blockHeight);
|
|
72
|
-
context.lineTo(x1Pixel, canvas.height);
|
|
73
|
-
context.strokeStyle = window
|
|
74
|
-
.getComputedStyle(canvas)
|
|
75
|
-
.getPropertyValue('color');
|
|
76
|
-
context.stroke();
|
|
77
|
-
}
|
|
78
|
-
}, [blockStartingTimes, zoomContextValue]);
|
|
79
|
-
const showValueLine = (0, react_1.useCallback)(() => {
|
|
80
|
-
const canvas = canvasRef.current;
|
|
81
|
-
const preValueLineElement = preValueLineRef.current;
|
|
82
|
-
const valueLineElement = valueLineRef.current;
|
|
83
|
-
const postValueLineElement = postValueLineRef.current;
|
|
84
|
-
const valueLineWidth = (0, utils_1.getComputedElementWidth)(valueLineElement);
|
|
85
|
-
const linePosition = (0, utils_1.secondsToPixel)(zoomContextValue, value);
|
|
86
|
-
const valueLinePositionBeginningConsideringWidth = linePosition - valueLineWidth / 2;
|
|
87
|
-
// configure preValueLineElement
|
|
88
|
-
preValueLineElement.style.width = (0, utils_1.numberToPxString)(valueLinePositionBeginningConsideringWidth);
|
|
89
|
-
// configure valueLineElement
|
|
90
|
-
valueLineElement.style.left = (0, utils_1.numberToPxString)(valueLinePositionBeginningConsideringWidth);
|
|
91
|
-
// configure postValueLineElement
|
|
92
|
-
const postValueLinePosition = valueLinePositionBeginningConsideringWidth + valueLineWidth;
|
|
93
|
-
const postValueLineWidth = canvas.width - postValueLinePosition;
|
|
94
|
-
postValueLineElement.style.left = (0, utils_1.numberToPxString)(postValueLinePosition);
|
|
95
|
-
postValueLineElement.style.width = (0, utils_1.numberToPxString)(postValueLineWidth);
|
|
96
|
-
}, [value, zoomContextValue]);
|
|
97
|
-
(0, react_1.useEffect)(() => {
|
|
98
|
-
const canvas = canvasRef.current;
|
|
99
|
-
// https://stackoverflow.com/questions/8696631/canvas-drawings-like-lines-are-blurry
|
|
100
|
-
canvas.width = canvas.offsetWidth;
|
|
101
|
-
canvas.height = canvas.offsetHeight;
|
|
102
|
-
showBlocks(canvas);
|
|
103
|
-
showValueLine();
|
|
104
|
-
}, [showBlocks, showValueLine]);
|
|
105
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
106
|
-
react_1.default.createElement(OverlayCanvas, { ref: canvasRef, className: 'media-timeline-value-line-canvas' }),
|
|
107
|
-
react_1.default.createElement(PreValueLine, { ref: preValueLineRef, className: 'media-timeline-pre-value-line' }),
|
|
108
|
-
react_1.default.createElement(ValueLine, { ref: valueLineRef, className: 'media-timeline-value-line' }),
|
|
109
|
-
react_1.default.createElement(PostValueLine, { ref: postValueLineRef, className: 'media-timeline-post-value-line' })));
|
|
110
|
-
};
|
|
111
|
-
exports.default = VaLueLineCanvas;
|
package/dist/reportWebVitals.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const reportWebVitals = (onPerfEntry) => {
|
|
27
|
-
if (onPerfEntry && onPerfEntry instanceof Function) {
|
|
28
|
-
Promise.resolve().then(() => __importStar(require('web-vitals'))).then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
|
29
|
-
getCLS(onPerfEntry);
|
|
30
|
-
getFID(onPerfEntry);
|
|
31
|
-
getFCP(onPerfEntry);
|
|
32
|
-
getLCP(onPerfEntry);
|
|
33
|
-
getTTFB(onPerfEntry);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
exports.default = reportWebVitals;
|
package/src/reportWebVitals.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ReportHandler } from 'web-vitals';
|
|
2
|
-
|
|
3
|
-
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
|
4
|
-
if (onPerfEntry && onPerfEntry instanceof Function) {
|
|
5
|
-
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
|
6
|
-
getCLS(onPerfEntry);
|
|
7
|
-
getFID(onPerfEntry);
|
|
8
|
-
getFCP(onPerfEntry);
|
|
9
|
-
getLCP(onPerfEntry);
|
|
10
|
-
getTTFB(onPerfEntry);
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default reportWebVitals;
|