Supporting More Web APIs in web-sys
-
Ensure that the
.webidlfile describing the interface exists somewhere within thecrates/web-sys/webidls/enableddirectory.First, check to see whether we have the WebIDL definition file for your API:
grep -rn MyWebApi crates/web-sys/webidls-
If your interface is defined in a
.webidlfile that is inside thecrates/web-sys/webidls/enableddirectory, skip to step (3). -
If your interface isn't defined in any file yet, find the WebIDL definition in the relevant standard and add it as a new
.webidlfile incrates/web-sys/webidls/enabled. Make sure that it is a standard Web API! We don't want to add non-standard APIs to this crate. -
If your interface is defined in a
.webidlfile within any of thecrates/web-sys/webidls/unavailable_*directories, you need to move it intocrates/web-sys/webidls/enabled, e.g.:cd crates/web-sys git mv webidls/unavailable_enum_ident/MyWebApi.webidl webidls/enabled/MyWebApi.webidl
-
-
Regenerate the
web-syscrate auto-generated bindings, which you can do with the following commands:cd crates/web-sys cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.tomlYou can then use
git diffto ensure the bindings look correct.