web-sys[1] generates the binding code using the same IDL files that browsers use to generate their JS bindings to the C++ doing the actual work.
[1] https://github.com/rustwasm/wasm-bindgen/tree/main/crates/we...
[1] https://github.com/rustwasm/wasm-bindgen/tree/main/crates/we...