webassembly: interact with browser without javascript

Viewed 1623

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?

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.

Related