Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

webassembly: interact with browser without javascript

Tags:

webassembly

Is there a webassembly API allowing webassembly code to interact with the browser without javascript? Accessing the network, the DOM, and OpenGL, for instance. For OpenGL in particular, it's ridiculous that I have to put every function call through javascript first. There's gotta be an enormous performance penalty associated with that.

If not, are there any plans for such APIs?

like image 765
enigmaticPhysicist Avatar asked Feb 27 '26 10:02

enigmaticPhysicist


1 Answers

Is there a WebAssembly API allowing WebAssembly code to interact with the browser without javascript?

No, currently there is not any such API. Currently WebAssembly can only export / import simple functions from the host environment - these are restricted to using the WebAssembly type system (which only has 4 integer types). For this reason, most people use tooling to generate binding / glue code, e.g. wasm-bindgen.

If not, are there any plans for such APIs?

Yes there are, possibly the most significant is interface types, which is a rich 'language' for describing interfaces, which will allow a much more versatile WebAssembly / host interface without any glue code in the future.

like image 178
ColinE Avatar answered Mar 02 '26 16:03

ColinE



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!