mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-04 04:22:08 +03:00
823f57698c
* Deprecate `JsValue::from_serde` and `JsValue::into_serde` I've listed `serde-wasm-bindgen` as the replacement, and changed the section of the guide that talks about Serde to talk about `serde-wasm-bindgen` instead of the deprecated methods. I didn't remove it entirely because I can imagine someone remembering it and trying to look it back up, only to find that it no longer exists, which would quite frustrating. I also added a footnote about the deprecated methods in case someone remembers the old way and wants to know what happened. There were several examples using `from_serde`/`into_serde`, which I updated to use `serde-wasm-bindgen` or not use `serde` altogether. The `fetch` example was a bit weird, in that it took a JS value, parsed it into a Rust value, only to serialize it back into a JS value. I removed that entirely in favour of just passing the original JS value directly. I suppose it behaves slightly differently in that it loses the extra validation, but a panic isn't all that much better than a JS runtime error. * fmt * Mention JSON as an alternative to `serde-wasm-bindgen` * Use `gloo-utils` instead of raw `JSON` I was considering leaving the examples using `JSON` directly and mentioning `gloo-utils` as an aside, but that has the major footgun that `JSON.stringify(undefined) === undefined`, causing a panic when deserializing `undefined` since the return type of `JSON::stringify` isn't optional. `gloo-utils` works around this, so I recommended it instead. * Mention `gloo-utils` in API docs * Rephrase section about deprecated methods |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
index.html | ||
index.js | ||
package.json | ||
README.md | ||
webpack.config.js | ||
webxr.js |
WebXR Example
View documentation for this example online or View compiled example online
You can build the example locally with:
# Note: Requires unstable flag whilst WebXR in development
$ RUSTFLAGS=--cfg=web_sys_unstable_apis npm run serve
and then visiting http://localhost:8080 in a browser should run the example!