A non-obvious thing I've learned about Wasm in browsers is that a hypothetical future DOM API interop feature might not be built on top of JS interop.

DOM APIs are defined in WebIDL, which has a lot of type information. For example, a WebIDL `dictionary` has a fixed set of fields. In source languages which have `struct` types, a `dictionary` might be best passed as a `struct`, rather than going through the JS representation of a `dictionary`.

`externref`, custom descriptors, js-string-builtins, etc. can help code that's aware it's talking to JS, but won't necessarily be the best tools for code that wants to talk to browsers.

0

If you have a fediverse account, you can quote this note from your own instance. Search https://hachyderm.io/users/sunfish/statuses/114472650364900297 on your instance and quote it. (Note that quoting is not supported in Mastodon.)