Closed ross-weir closed 1 year ago
Latest commit: 9dbc6deceae3641e8306384be389006ad94d92bc
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Changes
This PR adds the following:
JsValue
into a rust struct that is wasm binded (required for the below 2 array ops)Related
wasm-bindgen
issues:The problem with using JSON /
serde
for handling passing/receiving arrays is that deser/ser converts to JS objects instead of classes so library consumers can't use class methods without converting to or from JSON first. With the derives added in this PR this is no longer neededSimple example not using arrays but to describe the problem with JSON:
Rust
JS
The hope is one day
wasm_bindgen
supports vecs of structs so we can remove this 😄