-
Notifications
You must be signed in to change notification settings - Fork 567
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
Simple wasm example #801
Simple wasm example #801
Conversation
FWIW, you should be able to compile and serve almost all the examples unchanged so long as |
34c32f5
to
d4ad7aa
Compare
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.
This looks good to me, but I haven't tried building it. @elrnv any input?
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.
Looks good, the readme instructions work.
Seems to have unused dependencies tho.
This builds and runs for me perfectly :) I would add two things.
|
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.
As this is a new package it needs to also be added to the CI.
It's pretty straightforward, look into the ci.yml file and copy the druid-wasm-examples clippy/build steps.
@Finnerale @xStrom sorry for the long delay but I've finally addressed your comments. Not sure why the Cargo.lock is conflicting, it wasn't yesterday. |
It's conflicting because it doesn't exist anymore. You need to rebase with |
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.
Thanks for continuing this!
Some more nitpicking, but then it should be good to go.
|
||
const VERTICAL_WIDGET_SPACING: f64 = 20.0; | ||
const TEXT_BOX_WIDTH: f64 = 200.0; | ||
const WINDOW_TITLE: LocalizedString<HelloState> = LocalizedString::new("Hello World!"); |
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.
Window titles can be normal strings now 🎉
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.
looks like window title isn't used by the web version so I'm leaving it off entirely now
// hello.rs example. | ||
#[wasm_bindgen] | ||
pub fn wasm_main() { | ||
std::panic::set_hook(Box::new(console_error_panic_hook::hook)); |
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.
Would be nice if this one could get a comment, explaining that this is necessary to get panic messages on wasm32.
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.
I was unaware of what this actually did, so I hope my copy of your explanation is sufficient.
Okay, I believe I've addressed all comments. Also, I realized I hadn't updated the index.js to refer to the different package name, so that's fixed now as well. |
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.
Looks like a good start.
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.
Looks good!
This depends on #759 and should be merged after (and will def need some changes before that!).
Just wanted to get something up so I could get some feedback. A couple questions: