简体   繁体   中英

Does Webassembly end up as rendered HTML in the browser?

Webassembly can compile say C# to bytecode, executable by the browser.What is its rendered form in the browser? HTML with JavaScript? Or something like Silverlight or a Java applet that runs inside the browser such as a business app with rich GUIs?

Your application code written in C# is compiled into asp.net assembly, and is managed by the mono run time, which was compiled to WebAssembly. What is rendered in the browser is html through manipulation of the DOM using JavaScript interop; that is, your C# code communicate with JavaScript code to manipulate the DOM, and rerender the diffs.

In simple terms WebAssembly is a lightweight virtual machine that can executed numeric instructions. It cannot render HTML, or use any WebAPIs directly.

You can however import / export WebAssembly functions to allow it to communicate with JavaScript. Therefore WebAssembly apps tend to use DOM or canvas via Javascript bindings.

Details about JS - WASM interoperability:

https://developer.mozilla.org/en-US/docs/WebAssembly/Using_the_JavaScript_API https://kevinhoffman.medium.com/javascript-interop-with-webassembly-2c69a3db19e9

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM