3 ms·
It's really not that hard. Node.js has a very mature C FFI for interacting with JavaScript. Just agree on some basic bindings wasb_create_u32(env: *const e
by apatheticonion 1y ago
It's really not that hard. Node.js has a very mature C FFI for interacting with JavaScript.
Just agree on some basic bindings
wasb_create_u32(env: *const env, value: u32, result *mut value) -> status
wasb_create_string_utf8(env: *const env, str: *const c_char, length: i32, result: *mut value) -> status
There is even a shim that ports the Node.js C FFI to wasm: https://github.com/devongovett/napi-wasm/blob/main/index.mjs#L400 https://github.com/devongovett/napi-wasm/blob/main/index.mjs...
Heck, just include that in the browser so it doesn't need to be loaded at runtime
Stack that with support in the browser for wasi and you have everything you need to work with the DOM from wasm as well as things like threading