The Emscripten module versus the WebAssembly object
In the previous chapter, we briefly covered Emscripten's Module
object and how to load it in the browser. The Module
object provides several convenient methods and differs significantly from the browser's WebAssembly
object. In this section, we're going to review Emscripten's Module
object in greater detail. We'll also discuss the difference between Emscripten's Module
and the objects described in WebAssembly's JavaScript API.
What is the Emscripten module?
Emscripten's official site provides the following definition for the Module
object:
"Module is a global JavaScript object with attributes that Emscripten-generated code calls at various points in its execution."
Not only is the loading procedure different from WebAssembly's compile
and instantiate
functions, but the Module
provides some helpful functionality out of the box that would otherwise require a custom implementation in WebAssembly. The Module
is available in a global scope (window...