Clone in a terminal:
main.js
let wasmModule;

async function loadWasm() {
  try {
    const wasmModule = await import("./clickcounter.js");
    await wasmModule.default("./clickcounter_bg.wasm");

    return wasmModule;
  } catch (error) {
    console.error("Failed to load WASM module:", error);
  }

  return null;
}

window.addEventListener("DOMContentLoaded", async () => {
  wasmModule = await loadWasm();
});

File history (2 commits)

760267c Johan Mattsson - johan.mattsson.m@gmail.com
Update example
Update example
3fa1086 Johan Mattsson - johan.mattsson.m@gmail.com
Add closure test
Add closure test

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112