Hello all, I always liked that Rust offered wasm-bindgen, along with js-sys and web-sys, which provided bindings generated from webidl. And I wanted the same thing for C++.
Wasmbind itself consists of 2 libraries: - jsbind, provides some javascript interfaces required by webbind, with some sugar as well. - webbind, which is generated from webidl via the @webref/idl npm package. This allows for a less stringly-typed api than for example directly using emscripten's val api. I would appreciate your review and trial. This is the repository: https://github.com/emlite/wasmbind A wasmbind emscripten example: https://github.com/emlite/wasmbind-emscripten-example Note that wasmbind can also target wasm32-unknown-unknown and wasm32-wasi using wasi-libc, wasi-sysroot or the wasi-sdk. The api looks like: #include <jsbind/jsbind.hpp> #include <webbind/webbind.hpp> using jsbind::Console; using jsbind::Function; using namespace webbind; int main() { emlite::init(); Console con; auto document = window().document(); auto bodies = document.getElementsByTagName("body"); if (bodies.length() == 0) { con.log("I Ain't got Nobody!"); return -1; } auto body = bodies.item(0); auto button = document.createElement("BUTTON") .safe_cast<HTMLButtonElement>().unwrap(); button.textContent("Click me"); button.addEventListener( "click", Function::Fn<void(PointerEvent)>([=](auto e) { con.log(e.clientX()); }) ); body.appendChild(button); auto style = button.style(); style.setProperty("color", "red"); style.setProperty("background-color", "#aaf"); style.setProperty("border", "solid"); } -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/emscripten-discuss/c63b60a0-34d6-4f17-ba2b-987c73e3521bn%40googlegroups.com.
