-
Notifications
You must be signed in to change notification settings - Fork 569
Open
Labels
NeedsHelpCommunity contributions are welcome for this feature!Community contributions are welcome for this feature!enhancement
Milestone
Description
What strategy do people use to expose nested properties of complex objects? My server has a model with a few levels of nesting, and I would also like it on my client. Using the GopherJS playground, I'm basically in the following situation:
http://www.gopherjs.org/playground/#/ZAk7djDe8v
And I would be happy if either of the following worked in JS:
// Access nested data structures by fields
newA().B.C.DoSomethingCool()
// Access nested data structures using getters
newA().GetB().GetC().DoSomethingCool()
I believe I have the following options:
- Maintain mirror builders for both the JS and Go versions, so that every NewX() has a NewXWrapper()
- Use the Reflect package to iterate through my object and build an arbitrarily-complex js.Object
- Flatten the model so that everything is accessible from A (I don't want to do this, but it may be necessary for mobile anyways)
Is there anything I missed?
Metadata
Metadata
Assignees
Labels
NeedsHelpCommunity contributions are welcome for this feature!Community contributions are welcome for this feature!enhancement