Files
havox/projects/tsp/wasm.js
John Gatward 3cb8d5a14e tsp
2026-03-18 15:24:08 +00:00

25 lines
495 B
JavaScript

export async function initWasm() {
let wasmMemory = new WebAssembly.Memory({
initial: 256,
maximum: 256
});
let importObject = {
env: {
memory: wasmMemory,
}
};
const response = await fetch("./main.wasm");
const wasmModule = await WebAssembly.instantiateStreaming(response, importObject);
const { initialisePoints, getPointOrder, memory } = wasmModule.instance.exports;
return {
initialisePoints,
getPointOrder,
memory,
wasmMemory
}
}