<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>なでしこ3Rustテスト</title>
<script type="module">
import init, { nako_eval_str, nako_eval_getlogs }
from 'https://cdn.jsdelivr.net/npm/nadesiko3rust@0.2.0/nadesiko3rust.js';
async function runWasm() {
await init(); const greeting = nako_eval_getlogs("「こんにちは、なでしこ3です。」と表示。");
console.log(greeting); document.getElementById('runButton').addEventListener('click', () => {
const code = document.getElementById('code').value;
const result = nako_eval_getlogs(code);
document.getElementById('output').textContent = result;
});
}
runWasm().catch(console.error);
window.nako3_handler = (name, arg) => {
console.log(name, arg);
return arg;
}
</script>
</head>
<body>
<h1>なでしこ3Rustのテスト</h1>
<div>
<textarea id="code" rows="10" cols="50">
「はろー」と言う。
「こんにちは」と表示。
1+2×3と表示。
</textarea>
</div>
<div>
<button id="runButton">実行</button>
</div>
<div><pre id="output"></pre></div>
</body>
</html>