2018-05-03 02:12:03 +02:00

19 lines
439 B
JavaScript

const fs = require("fs");
const path = require("path");
const compiled = new WebAssembly.Module(
fs.readFileSync(path.resolve(__dirname, "..", "build", "rust.optimized.wasm"))
);
const imports = {
env: {
abort: (filename, line, column) => {
throw Error("abort called at " + line + ":" + colum);
}
}
};
Object.defineProperty(module, "exports", {
get: () => new WebAssembly.Instance(compiled, imports).exports
});