boa icon indicating copy to clipboard operation
boa copied to clipboard

How do you properly call an async function under tokio?

Open leobelen opened this issue 2 years ago • 0 comments

Describe the bug There is no clear way to use async native functions. The only thing that happens right now it that it hangs. If you run https://github.com/SurferTank/boats_async_fn you will see an example.

I see we need to provide a job queue executor, but no examples are available except for https://github.com/boa-dev/boa/blob/90048f2eff99c5699a9ba3d6e4ecb10f05e79105/boa_examples/src/bin/futures.rs but it describes how to use smog. Could we have a similar example using tokio too?

To Reproduce Steps to reproduce the issue, or JavaScript code that causes this failure. git clone https://github.com/SurferTank/boats_async_fn; cd boats_async_fn cargo r

Expected behavior the code should run without a hang.

Build environment (please complete the following information):

  • OS: MacOS
  • Version: Sonoma
  • Target triple: aarch64-apple-darwin
  • Rustc version: 1.76.0-nightly (5ac4c8a63 2023-12-20)

leobelen avatar Dec 21 '23 22:12 leobelen