Skip to content
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

Questions: Wasm modules with Javascript and flutter_rust_bridge async support #37

Open
limcheekin opened this issue Oct 2, 2023 · 3 comments

Comments

@limcheekin
Copy link

limcheekin commented Oct 2, 2023

Hi there,

First of all, thanks for created and published the package.

I have the following questions regarding the package:

  1. How to run Wasm modules with Javascript across platforms such as Android, iOS, Linux, Windows, etc?
  2. From my understanding, the flutter_rust_bridge doesn't support async rust code officially, is there any solution offered by the package?

Appreciate if there are sample projects that answer the questions above.

Please advise. Thank you.

@juancastillo0
Copy link
Owner

Hi, thanks for the issue!

  1. This is primarily a Dart package. Could you explain how is the interaction with Javascript? You don't need much Javascript to use this package. However, the same wasm module could be reused on both languages. Could you explain more of what you mean?

  2. You can find more information in their documentation. However I think you could do it by using StreamSink as an argument to a Rust function. Within this package we provide a way to run function from threaded wasm modules asynchronously.

You can see the latest code and multiple packages examples that use wasm_run in this PR #14

@limcheekin
Copy link
Author

limcheekin commented Oct 3, 2023

Hi, thanks for the issue!

  1. This is primarily a Dart package. Could you explain how is the interaction with Javascript? You don't need much Javascript to use this package. However, the same wasm module could be reused on both languages. Could you explain more of what you mean?
  2. You can find more information in their documentation. However I think you could do it by using StreamSink as an argument to a Rust function. Within this package we provide a way to run function from threaded wasm modules asynchronously.

You can see the latest code and multiple packages examples that use wasm_run in this PR #14

Thanks for quick response.

  1. As code speak louder and clearer, let's me show you some codes :). The surrealdb.wasm is built by wasmpack and the wasm-bindgen will produce a JavaScript bindings (index.js) and a wasm module (index_bg.wasm). A single-page application or static html need to use the JavaScript bindings in order to interact with the wasm module, please take a look on the code here. I managed to integrate the JavaScript bindings and wasm module of surrealdb.wasm into a Flutter Web app using package:js. My question: How the wasm_run package able to make the surrealdb.wasm run across platforms such Android, iOS, Linux, Windows, including Web with/without JavaScript?
  2. Could you elaborate more on the statement Within this package we provide a way to run function from threaded wasm modules asynchronously? Better with code snippets.

I will look into PR #14.

Please advise. Thank you.

@MulverineX
Copy link

We might be up for partnering on this https://github.com/openwebf/mercury

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants