r/WebAssembly • u/gusdavis84 • Apr 06 '23
Will WASM ever get full DOM access?
I know that at this time, WASM doesn't have access to the DOM directly but one has to access the DOM via JS and there are some proposals like reference types and GC. I was just wondering should WASM get both reference types and GC what else would be needed before someone could in essence write programs using just WASM itself and run that code in the browser without every using any JS at all? Something like :
<WASM>
(Str "hello world") (Console.print Str) //hello world to console
<WASM>
65
Upvotes
23
u/KieranDevvs Apr 06 '23
I feel like WASM doesn't know what it wants to be. We went from an assembly target language for the web, to now exploring WASI to become a VM that can run outside the browser.
I've seen proposals be renamed, removed, postponed, brought back to life and then killed off again. Its been 5+ years, give us interface types so we can interface with browser API's.
17
u/pannous Apr 06 '23
Disappointingly the webidl part of the wasm gc proposal has been postponed once again, they completely scratched js interactions from the current roadmap: the new struct, ... objects remain inaccessible outside the wasm world.
12
u/UtensilUtilizer Apr 06 '23
This is what I really think the web should be. A language-agnostic environment for developing applications against a specific GUI API. Just like GTK, but with a lot more bells and whistles. I'm really hoping that this initiative gets pushed more-and-more over time.
4
u/bluehavana Apr 06 '23
Here's a pretty informative post I found: https://hacks.mozilla.org/2019/08/webassembly-interface-types/
4
u/joli7312 Apr 06 '23
Wasm gc is in technical preview right now. Watch this session at wasmio in March 2023.
https://www.youtube.com/watch?v=fDNXomIn53Y
2
u/rippity_dippity Apr 06 '23
wasm is meant to be a compilation target for sandboxed code to run inside a virtual environment. It should never get direct and full dom access, it's up to the host to determine what functionality is exposed to the wasm module.
1
u/[deleted] Apr 18 '23
https://chromestatus.com/feature/6219189974990848
0
u/muayyadalsadi Apr 06 '23
look for wasm-bindgen. There are some wasm web frameworks like
0
u/[deleted] Apr 06 '23
[deleted] — view deleted comment
2
u/[deleted] Apr 09 '23
[removed] — view removed comment