September 2018
Intermediate to advanced
328 pages
9h 10m
English
In order to utilize JavaScript's functionality in your C/C++ code, you need to add a function definition to the importObj.env argument that gets passed into WebAssembly's instantiation function. You can either define the function outside of the importObj.env or inline. The following code snippet demonstrates each option:
// You can define the function inside of the env object:const env = { // Make sure you prefix the function name with "_"! _logValueToConsole: value => { console.log(`'The value is ${value}'`); }};// Or define it outside of env and reference it within env:const logValueToConsole = value => { console.log(`'The value is ${value}'`);};const env = { _logValueToConsole: logValueToConsole ...Read now
Unlock full access