forked from WebKit/Speedometer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
41 lines (38 loc) · 1.86 KB
/
index.js
File metadata and controls
41 lines (38 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { useEffect } from "react";
import { HashRouter as Router, Routes, Route } from "react-router-dom";
import Page from "@/partials/page/page";
import Head from "next/head";
import { DataContextProvider } from "@/context/data-context";
import { BenchmarkConnector } from "speedometer-utils/workload-testing-utils.mjs";
import suites from "@/workload-test.mjs";
export default function App() {
// Using 'useLayoutEffect' here, since this will connect the workload after all DOM mutations happened.
// This ensures that all elemetns are in the DOM, prior to signaling to the Benchmark that the workload is ready to run a test suite.
useEffect(() => {
const benchmarkConnector = new BenchmarkConnector(suites, "news-next", 1);
benchmarkConnector.connect();
return () => benchmarkConnector.disconnect();
}, []);
return (
<>
<Head>
<title>The Daily Broadcast</title>
<meta name="description" content="A news site developed with Next.js." key="description" />
</Head>
<DataContextProvider>
<Router>
<Routes>
<Route path="/business" element={<Page id="business" />} />
<Route path="/health" element={<Page id="health" />} />
<Route path="/opinion" element={<Page id="opinion" />} />
<Route path="/politics" element={<Page id="politics" />} />
<Route path="/us" element={<Page id="us" />} />
<Route path="/world" element={<Page id="world" />} />
<Route path="/home" element={<Page id="home" />} />
<Route path="/" element={<Page id="home" />} />
</Routes>
</Router>
</DataContextProvider>
</>
);
}