The WebAssembly.compile() function compiles a WebAssembly.Module from WebAssembly binary code. This function is useful if it is necessary to a compile a module before it can be instantiated (otherwise, the WebAssembly.instantiate() function should be used).

In the worker (see wasm_worker.js) we define an import object for the module to use, then set up an event handler to receive the module from the main thread. when the module is received, we create an instance from it using the WebAssembly.Instantiate() method, invoke an exported function from inside it, then show how we can return information on the available exports on a module using the WebAssembly.Module.exports property.