You can write a WASM program today that touches the DOM, it just needs to go through the regular JS APIs. While there were some discussions early on about making custom APIs for WASM to access, that has long since been dropped - there are just too many downsides.
cedws|5 months ago
austin-cheney|5 months ago
bonestamp2|5 months ago
I see good use cases for building entirely in html/JS and also building entirely in WASM.
brokencode|5 months ago
The only issue is that there’s a performance cost. Not sure how significant it is for typical applications, but it definitely exists.
It’d be nice to have direct DOM access, but if the performance is not a significant problem, then I can see the rationale for not putting in the major amount of work work it’d take to do this.
lyu07282|5 months ago
benrutter|5 months ago
Say I really want to write front end code in Rust* does there just need to be a library that handles the js DOM calls for me? After that, I don't ever have to think about javascript again?
tcfhgj|5 months ago
yes, e.g. with Leptos you don't have to touch JS at all
colordrops|5 months ago
nasso_dev|5 months ago
https://hacks.mozilla.org/2018/10/calls-between-javascript-a...
zekrioca|5 months ago
cogman10|5 months ago
But further, WASM is more than just a browser thing at this point. You might be running in an environment that has no DOM to speak of (think nodejs). Having this bolted on extension simply for ease of use means you now need to decide how and when you communicate its availability.
And the benefits just aren't there. You can create a DOM exposing library for WASM if you really want to (I believe a few already exist) but you end up with a "what's the point". If you are trying to make some sort of UX framework based on wasm then you probably don't want to actually expose the DOM, you want to expose the framework functions.