now, is there a way to assign x to window.x ? Basically I want to be able (from JS land) do window.x.func_name and call the functions in impl Foo { ... }
The part I can't figure out is: how do we assign x: Foo to window.x ?
You could use Object::define_property(&js_sys::global(), &JsValue::from_str("x"), desc) I think. Where desc is a JsValue that represents the object { value: x }.