Return results from execute_main_module
I currently have this function to run some execute some js
I was wondering how I could modify this to return the result of the executed javascript?
4 Replies
JS modules don't have results, unless you mean the module namespace object
Not quite sure what you mean, but overall goal is to sort maintain similar flow you see above, and then be able to return the result to the Rust program, is that something that possible? I saw this issue --> https://github.com/denoland/deno/issues/11105, but when I tried to run certain js programs that used things like 'fetch' with execute_script nothing occurred, so opted for execute_main_module.
But yeah if you have any advice for overall the best way to go about this, would really appreciate it!
GitHub
Issues · denoland/deno
A modern runtime for JavaScript and TypeScript. Contribute to denoland/deno development by creating an account on GitHub.
you'd have to use
run_event_loop
but IIRC you'd also need to use it for execute_main_module
if execute_script
returns a promise, you can run the event loop and wait until it resolves with JsRuntime::resolve_value
I see, do you know if there are any examples / docs that I could take a look at / build off of?