mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-09 00:09:55 +00:00
add1e79fea
Allow to send change events from typescript to bevy
Example (test)
```rust
CHANGE_FROM_UI.write_message(UpdateField {
component: "bevy_transform::components::transform::Transform".to_string(),
reflect_path: ".translation.x".to_string(),
value: 0.to_string(),
});
```
Function for typescript
```rust
#[wasm_bindgen(js_name = changeValue)]
pub fn change_value(msg: String) {
let Ok(msg) = serde_json::from_str::<UpdateField>(&msg) else {
error!("Failed to parse message: {}", msg);
return;
};
CHANGE_FROM_UI.write_message(msg);
}
```