I was following the tutorial on making a WASM application with Rust. I decided on not using a bundler, but I stumbled upon a question. When using a bundler, to access WASM's memory, I can simply import { memory } from "<package>/<package>_bg"
, but without it, I can't make it work. What I'm doing:
import init , * as wasm from "./wasm/inner.js";
async function run() {
await init();
window.wasm = wasm;
wasm.debug_mode();
}
run();
This code works, and I can call Rust's functions easily. The problem is accessing WASM's memory. How do I get a reference to it, or something? Is it even possible? I stumbled upon the possibility of doing let wasm = await init();
, but the methods inside this object don't work, neither does the memory
object inside of it.
Thanks in advance!