mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-21 12:43:57 +00:00
Preload analyzer
This commit is contained in:
@@ -3,6 +3,7 @@ import { Helmet } from "react-helmet";
|
||||
export interface HeaderProps {
|
||||
title: string;
|
||||
description: string;
|
||||
preload?: string[];
|
||||
}
|
||||
|
||||
const image =
|
||||
@@ -23,6 +24,16 @@ export function Header(props: HeaderProps) {
|
||||
<meta name="twitter:title" content={props.title} />
|
||||
<meta name="twitter:description" content={props.description} />
|
||||
<meta name="twitter:image" content={image} />
|
||||
|
||||
{props.preload?.map((l) => (
|
||||
<link
|
||||
key={`link-${l}`}
|
||||
rel="preload"
|
||||
as={l.endsWith(".js") ? "script" : "fetch"}
|
||||
crossOrigin=""
|
||||
href={`${l}${l.indexOf("?") == -1 ? "?" : "&"}cb=${import.meta.env.VITE_BUILD_TIME}`}
|
||||
/>
|
||||
))}
|
||||
</Helmet>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -206,6 +206,7 @@ export class Playground extends React.Component<
|
||||
<Header
|
||||
title="Sogen - Playground"
|
||||
description="Playground to test and run Sogen, the Windows user space emulator, right in your browser."
|
||||
preload={["./emulator-worker.js", "./analyzer.js", "./analyzer.wasm"]}
|
||||
/>
|
||||
<div className="h-[100dvh] flex flex-col">
|
||||
<header className="flex shrink-0 items-center gap-2 border-b p-2 overflow-y-auto">
|
||||
|
||||
@@ -11,4 +11,7 @@ export default defineConfig({
|
||||
"@": path.resolve(__dirname, "./src"),
|
||||
},
|
||||
},
|
||||
define: {
|
||||
"import.meta.env.VITE_BUILD_TIME": JSON.stringify(Date.now()),
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user