← Back to context Comment by pjmlp 3 days ago You can do that easily with binaryen already, and make use of parseText().https://web.dev/articles/binaryen 3 comments pjmlp Reply TekMol 3 days ago Not sure what you mean. I guess this is a misunderstanding.What I mean is that I would like something like this to work: code = `( func $add (param $a i32) (param $b i32) (result i32) local.get $a local.get $b i32.add )`; module = WebAssembly.compile(code); alert(module.add(3, 5)); // alerts "8". tyushk 3 days ago The WebAssembly reference interpreter [0] has a JS library that lets you do this. let wast = require("./wast.js"); let binary = wast.WebAssemblyText.encode("(module)"); [0] https://github.com/WebAssembly/spec/tree/main/interpreter#ja... pjmlp 3 days ago Which you can get by making use of binaren.js library already, so you won't get any browser vendor love to include the feature into the browsers directly.
TekMol 3 days ago Not sure what you mean. I guess this is a misunderstanding.What I mean is that I would like something like this to work: code = `( func $add (param $a i32) (param $b i32) (result i32) local.get $a local.get $b i32.add )`; module = WebAssembly.compile(code); alert(module.add(3, 5)); // alerts "8". tyushk 3 days ago The WebAssembly reference interpreter [0] has a JS library that lets you do this. let wast = require("./wast.js"); let binary = wast.WebAssemblyText.encode("(module)"); [0] https://github.com/WebAssembly/spec/tree/main/interpreter#ja... pjmlp 3 days ago Which you can get by making use of binaren.js library already, so you won't get any browser vendor love to include the feature into the browsers directly.
tyushk 3 days ago The WebAssembly reference interpreter [0] has a JS library that lets you do this. let wast = require("./wast.js"); let binary = wast.WebAssemblyText.encode("(module)"); [0] https://github.com/WebAssembly/spec/tree/main/interpreter#ja...
pjmlp 3 days ago Which you can get by making use of binaren.js library already, so you won't get any browser vendor love to include the feature into the browsers directly.
Not sure what you mean. I guess this is a misunderstanding.
What I mean is that I would like something like this to work:
The WebAssembly reference interpreter [0] has a JS library that lets you do this.
[0] https://github.com/WebAssembly/spec/tree/main/interpreter#ja...
Which you can get by making use of binaren.js library already, so you won't get any browser vendor love to include the feature into the browsers directly.