shortcuts/regr/mod.ts

19 lines
463 B
TypeScript
Raw Normal View History

2024-09-30 17:12:28 +00:00
import "../lib/wasm_tinygo.js";
2024-09-28 16:04:12 +00:00
2024-09-28 16:09:31 +00:00
// @ts-expect-error: no types
2024-09-28 16:04:12 +00:00
const go = new Go();
2024-09-28 16:09:31 +00:00
2024-09-28 16:04:12 +00:00
const code =
await (await fetch(import.meta.url.replace("/mod.ts", "/mod.wasm")))
.arrayBuffer();
2024-09-28 20:18:36 +00:00
2024-09-28 16:04:12 +00:00
const wasmMmodule = await WebAssembly.instantiate(code, go.importObject);
const wasm = wasmMmodule.instance;
2024-09-28 20:18:36 +00:00
2024-09-28 16:04:12 +00:00
go.run(wasm);
2024-09-28 20:18:36 +00:00
// @ts-ignore: no types
2024-10-02 16:11:01 +00:00
const _exports = __InitRegrExports(_exports) as Record<string, (...args: unknown[]) => unknown>;
2024-09-28 20:18:36 +00:00
export default _exports;