← Back to context

Comment by CGamesPlay

3 days ago

The async example in the readme is weird. It appears to be an example of tokio::sleep, where you synchronously call into your library before you sleep. Nothing about your library usage is async. In fact, the whole usage of the library is blocking, so I can't even call it from my existing async code. I'm expecting: I can call my async Rust function from JavaScript, and I can await a JavaScript async method. The example should at the very least be using `async fn main`.

You're right. I've actually removed it because it doesn't make sense.

There's now `call_blocking` and `call_async` to call a JavaScript function from Rust from normal and async call sites