11 WebAssembly text format
This chapter covers:
- Creating a WebAssembly text format version of a module
- Compiling the text format code into a binary module using the WebAssembly Binary Toolkit’s online tool
- Linking the Binary Toolkit’s generated module to an Emscripten generated module
- Building the HTML and JS for the UI aspect of the game
WebAssembly is designed with a binary file format, so that the WebAssembly files are as small as possible to allow for fast transmissions and downloads, but this doesn’t mean it’s a way for developers to hide their code. In fact, quite the opposite is true. WebAssembly is designed with the openness of the web in mind. As a result, a text format equivalent of the binary format also exists.
The text format allows browser users to inspect the WebAssembly of a webpage in much the same way that they would inspect JavaScript. The text format equivalent of the binary format is also presented for debugging in the browser if the WebAssembly module doesn’t include source maps as highlighted in figure 11.1.
Figure 11.1 The developer tools in Firefox, with a breakpoint placed in the _ValidateName function of the WebAssembly module that you built in chapter 4, section 4.1
