webtools/site/golines/main.js
Leon Mika 40e5379eb3
All checks were successful
/ publish (push) Successful in 2m43s
Added golines playground
2026-09-06 09:24:54 +10:00

12 lines
588 B
JavaScript

try {
await import("/wasm/wasm_exec.js");
const go = new Go();
const response = await fetch("/wasm/golines.wasm");
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const result = await WebAssembly.instantiate(await response.arrayBuffer(), go.importObject);
await go.run(result.instance);
} catch (error) {
document.getElementById("message").textContent = `Unable to load the formatter: ${error.message}. Please reload to try again.`;
document.getElementById("source").disabled = true;
document.getElementById("max-len").disabled = true;
}