pub fn run_script_string<T>(script: T) -> Option<String>
Expand description
Runs the given JavaScript script string with the eval()
JS function, in the calling thread,
using the emscripten-defined emscripten_run_script_string
.
It returns the return result of the script, interpreted as a string if possible.
Otherwise, it returns None.
§Arguments
script
- The script to execute.
§Examples
assert_eq!(run_script_string("alert('hi')"), None);
assert_eq!(run_script_string("2"), Some("2"));
assert_eq!(run_script_string("'hi'"), Some("hi"));