Files
pdf/test.html
T

49 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WASM Hello World</title>
</head>
<body>
<h1>WASM Hello World</h1>
<p>Open browser console (F12) to see output.</p>
<!-- Load generated Emscripten JS -->
<script src="wasm_hello.js"></script>
<script>
// Wait until WASM runtime is ready
Module.onRuntimeInitialized = () => {
console.log("WASM Runtime Initialized");
// Call C++ hello() function
Module.ccall(
'hello', // C++ function name
null, // return type
[], // argument types
[] // arguments
);
// Call C++ add() function
const result = Module.ccall(
'add', // function name
'number', // return type
['number', 'number'], // argument types
[5, 7] // arguments
);
console.log("Result =", result);
};
</script>
</body>
</html>