web_sys::JsValue setting fields of object

I'm looking at Object in js_sys - Rust

I feel like I am missing something really obvious:

How do I set

obj.foo = ...

?

I think you can use js_sys::Reflect::set, though I have no idea if that's what you should do.

1 Like

I've used js_sys::Reflect::get before.

Using set sounds reasonable -- but one thing confuses me. How do I even construct an object (from Rust land) to use with set ?

Object implements Default.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.