September 2018
Intermediate to advanced
328 pages
9h 10m
English
If you need a reusable function within your C/C++ file, you can wrap JavaScript code within an EM_JS() block and execute it like a normal C/C++ function. The definition for EM_JS() is described in the following code snippet:
EM_JS(return_type, function_name, arguments, code)
The return_type parameter represents the C type that corresponds with the JavaScript code's output (for example, int or float). If nothing is returned from the JavaScript code, specify void for the return_type. The next parameter, function_name, represents the name to use when calling the JavaScript code from other locations in the C/C++ file. The arguments parameter is used to define arguments that can be passed into the JavaScript ...
Read now
Unlock full access