This commit is contained in:
parent
09fceca2f9
commit
40e5379eb3
11 changed files with 250 additions and 2 deletions
12
site/golines/main.js
Normal file
12
site/golines/main.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue