Function emscripten_functions::emscripten::run_script_int
source · pub fn run_script_int<T>(script: T) -> c_intwhere
T: AsRef<str>,
Expand description
Runs the given JavaScript script string with the eval()
JS function, in the calling thread,
using the emscripten-defined emscripten_run_script_int
.
It returns the return result of the script, interpreted as a C int.
Most probably the return result is passed to parseInt()
, with NaN represented as 0.
If you need to run the script in the main thread, check out run_script_main_thread_int
.
Arguments
script
- The script to execute.
Examples
assert_eq!(run_script_int("1 + 2"), 3);