2021-03-21 07:41:36 +07:00
|
|
|
import wasm from './api/main.go';
|
|
|
|
|
|
|
|
const { hello, helloName } = wasm;
|
|
|
|
|
2021-03-22 06:46:19 +07:00
|
|
|
const value = document.getElementById("value");
|
|
|
|
const input = document.getElementById("input");
|
|
|
|
const funcValue = document.getElementById("funcValue");
|
|
|
|
|
|
|
|
const run = async () => {
|
|
|
|
value.innerText = await hello();
|
|
|
|
|
|
|
|
funcValue.innerText = await helloName(input.value);
|
|
|
|
input.addEventListener("keyup", async (e) => {
|
|
|
|
funcValue.innerText = await helloName(e.target.value);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
run()
|