Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
juztamau5 committed Mar 12, 2024
1 parent bc78382 commit e30550d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/frontend/src/components/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ import RetroEngineModule, {
RetroEngine,
} from "../wasm/retro_engine.js";

// Provide the locateFile function when initializing the WASM module.
// Needed because the generated JS loader and types are placed in /src,
// but the WASM binary is placed in /public.
const moduleOverrides = {
locateFile: (file: string) => `/wasm/${file}`,
};

const HomePage: React.FC = () => {
// Reference to the canvas element
const canvasRef = useRef<HTMLCanvasElement | null>(null);
Expand All @@ -38,11 +45,6 @@ const HomePage: React.FC = () => {
let engineInstance: RetroEngine | null = null;

async function initializeAndUseRetroEngine(): Promise<void> {
// Provide the locateFile function when initializing your WASM module
const moduleOverrides = {
locateFile: (file: string) => `/wasm/${file}`,
};

// Await the promise to resolve to the module instance
const wasmModule: MainModule = await RetroEngineModule(moduleOverrides);

Expand Down

0 comments on commit e30550d

Please sign in to comment.