diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
commit | 9835e2ae736235810b4ea1c162ca5e65c547e770 (patch) | |
tree | 3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/web-sys/README.md | |
parent | Releasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff) | |
download | rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip |
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/web-sys/README.md')
-rw-r--r-- | vendor/web-sys/README.md | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/vendor/web-sys/README.md b/vendor/web-sys/README.md new file mode 100644 index 000000000..71bb2be31 --- /dev/null +++ b/vendor/web-sys/README.md @@ -0,0 +1,35 @@ +# `web-sys` + +Raw bindings to Web APIs for projects using `wasm-bindgen`. + +* [The `web-sys` section of the `wasm-bindgen` + guide](https://rustwasm.github.io/wasm-bindgen/web-sys/index.html) +* [API Documentation](https://rustwasm.github.io/wasm-bindgen/api/web_sys/) + +## Crate features + +This crate by default contains very little when compiled as almost all of its +exposed APIs are gated by Cargo features. The exhaustive list of features can be +found in `crates/web-sys/Cargo.toml`, but the rule of thumb for `web-sys` is +that each type has its own cargo feature (named after the type). Using an API +requires enabling the features for all types used in the API, and APIs should +mention in the documentation what features they require. + +## How to add an interface + +If you don't see a particular web API in `web-sys`, here is how to add it. + +1. Copy the WebIDL specification of the API and place it in a new file in the + `webidls/unstable` folder. You can often find the IDL by going to the MDN + docs page for the API, scrolling to the bottom, clicking the + "Specifications" link, and scrolling to the bottom of the specification + page. For example, the bottom of the [MDN + docs](https://developer.mozilla.org/en-US/docs/Web/API/MediaSession) on the + MediaSession API takes you to the + [spec](https://w3c.github.io/mediasession/#the-mediasession-interface). The + [very bottom](https://w3c.github.io/mediasession/#idl-index) of _that_ page + is the IDL. +2. Annotate the functions that can throw with `[Throws]` +3. Run `cargo run --release --package wasm-bindgen-webidl -- webidls src/features` +4. Copy the contents of `features` into the `[features]` section of `Cargo.toml` +5. Run `git add .` to add all the generated files into git. |