21 lines
433 B
JavaScript
21 lines
433 B
JavaScript
import { default as init, incr } from './build/fish_server_wasm.js'
|
|
|
|
async function main() {
|
|
await init('/fish_server_wasm_bg.wasm');
|
|
|
|
let counter = document.getElementById("counter");
|
|
let button = document.getElementById("incr");
|
|
|
|
function incrAndUpdate() {
|
|
counter.innerText = `${incr()}`;
|
|
}
|
|
|
|
button.addEventListener('click', () => {
|
|
incrAndUpdate();
|
|
});
|
|
|
|
incrAndUpdate();
|
|
}
|
|
|
|
main()
|