November 2019
Intermediate to advanced
448 pages
15h 6m
English
The second type of Emscripten macro available to WebAssembly modules is the EM_JS and EM_ASM series. The EM_JS macro offers a way of declaring JavaScript functions right in your C or C++ code, whereas the EM_ASM macros allow for the use of inline JavaScript.
Although the JavaScript code for all these macros is within your C or C++ code, the Emscripten compiler actually creates the necessary JavaScript functions and calls those functions behind the scenes when the module is running. For this section, you’re going to focus on the EM_JS macro; you’ll see the EM_ASM macros in the next section.
The EM_JS macro accepts four parameters:
Read now
Unlock full access