-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I await javascript promise from rust? #37
Comments
Just aware that node-bindgen uses Rust's async infrastructure rather than node's libuv. It uses [async.rs[(https://async.rs) for executor. So far, node-bindgen atomically maps rust's async to promise. So it should be possible to support invoking node.js function or object in the async fn or closure. For example:
I can put this under roadmap. What is your timetable? |
@sehz
I don't have any strict time table. |
Ok, I will try you put together first phase of solution so can unblock you. Probably in next 1-2 week. Also, there might be interesting colloberation between two projects. For example, it could be interesting to call JS using TS notation. And ability to export TS binding from Rust code. |
Thank you so much! I have a final exam next week so I love the plan.
Interesting. Auto-generating .d.ts file will be great. Note that |
It looks like this might be achievable using https://nodejs.org/api/n-api.html#n_api_napi_create_async_work feature/async branch has a work in progress on implementation. Not sure when the work will be completed, but wanted to post this note for later use. |
Hi. I'm the author of swc and I'm considering switching from neon to node-bindgen.
Can I store js function on struct and call it from other threads?
Neon supports it via
EventHandler
.Also, I need to wait for js promises to be resolved from rust code. Is it possible?
If these features are on the roadmap, please let me know.
The text was updated successfully, but these errors were encountered: