Any reason to use web-sys over stdweb for simple use-case?

I've been trying to understand how to drive a web canvas 2D animation from Rust and WASM. I think I've got a decent sense for what wasm-bindgen and web-sys do: providing low-level FFI and interaction between Rust and JS/DOM elements. But I think much of that capability is aimed at a much lower-level use case than mine, which is just to run a small simulation and clear and redraw a few pieces to a fixed canvas each iteration.

Based on that, it seems like stdweb can do everything I want a whole lot simpler (path, stroke, fill, etc.). If I have zero need to make a Rust struct available in JS and stdweb has methods to access every JS version I need, then I believe the only thing wasm-bindgen is needed for is the run entry point:

pub fn run() -> Result<(), JsValue> {
/* setup and run loop, use stdweb to draw */

Am I missing anything? In my searching on the topic I feel like I've come across more implementations using web-sys (such as here or here), but that stdweb versions seem equally capable (as seen here). Is web-sys just lower-level (and/or perhaps older)?

Stdweb looks unmaintained. Its last release was 3 years ago.

Specifically how? Web-sys has a Canvas example too, and it seems pretty straightforward.

1 Like

Maybe that's why there are noticeably more web-sys examples. And I suppose why I'd find more complex examples in it; more time in active development leads to more complex uses. Huh...

I guess the searched examples and the DOM hello world example seemed so far beyond what I wanted, vs. simple things like the canvas for this snake game.

I should have looked deeper into std-web... Thanks for the point in the right direction!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.