-
Notifications
You must be signed in to change notification settings - Fork 245
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
add wasm-backend using HTML canvas element #741
base: main
Are you sure you want to change the base?
Conversation
* add wasm-backend * add wasm configuration and replace sleep * add wasm-backend
* add wasm-backend * add wasm configuration and replace sleep * add wasm-backend * fix busy_waiting * fix busy waiting * add buffer to print * add js module * change passing parameter as pointer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a shallow, quick review; currently breaks builds due to changing default features.
thank you for taking a look:) I addressed what you mentioned |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from two more comments, looks pretty good overall!
Can also confirm that builds and tests now run through again without a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really just some nits this time, but generally LGTM. 👍
Thanks for the work! My main concern is that the
To avoid these two points, I'd be open to a major bump for API changes if needed, maybe even making async the default way to run the loop (or an option regardless of backend). |
@gyscos I made run as async. Could you have another look? |
(I'm finally back from a family trip and have at last some time to look at this PR in more depth.) Thanks for the updates and reactivity! Looking at the code more, I think we can actually avoid breaking changes by adding a parallel code-path for async (rather than replacing the existing one). The current "sync" API could be defined as simply calling The "bare minimum" would be to have EDIT: I tried to do that in a We could then, later, add the convenient equivalent. It also looks like the As a side-question, I'm wondering if this wasm backend would work in a non-browser wasm environment (like wasmtime?). I suspect not, so I'd favor calling it Also, would it be possible to add a very simple example using this backend? I haven't found how to use wasm-pack with an example, so maybe a dedicated "example" crate would be simpler. (I'm really sorry for the back-and-forth.) |
@gyscos thank you for your time and effort to review this PR.
regarding test, I'll make a simple project and let you know in a week |
@gyscos I made a simple project(https://github.com/genieCS/hello-wasm) for tests.
|
@gyscos canvas is for browser but it would not be hard to make other wasm backends work. regarding |
Add WebAssembly (WASM) backend to Cursive library
This PR adds a new backend to the Cursive library that allows it to be used in WebAssembly (WASM) environments. The new backend is implemented using the
web-sys
,js-sys
crates and provides a way to run Cursive-based applications in the browser.To use the new backend, simply enable the
wasm-backend
feature in yourCargo.toml
file:I made sample project using this backend, so you can see how to use this new backend.
repo link: https://github.com/genieCS/wretris
project link: https://geniecs.github.io