wails icon indicating copy to clipboard operation
wails copied to clipboard

Bind Struct for read as well

Open pierrejoye opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe.

Say:

I have a config that contains data required by the Frontend, for example a key or an API URL. This is static and defined using config files in the go side (set via menu and dialogs).

I try to use a function and call it later but the promise nature of it makes it actually available too late. I could modify the FE code accordingly but that's a major change that won't work for other targets like web or PWA

Describe the solution you'd like

Ability to bind a struct as readonly for example. A pure data structure on the FE side.

Alternatively the same as now, however with a getter as well (right now only a setter is generated).

Describe alternatives you've considered

I have to do one build per API/Key pair, not scalable :)

I am pretty sure however it is possible already but I may have missed it completely :)

Additional context

No response

pierrejoye avatar Jun 07 '22 12:06 pierrejoye

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 10 '22 14:07 stale[bot]

@pierrejoye could you please provide another example of what you want as it isn't clear to me. Thanks!

leaanthony avatar Jul 10 '22 19:07 leaanthony

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 02 '22 02:11 stale[bot]

example: go:

type App struct{
    Data string
}

js:

console.log(App.Data)

aadog avatar Nov 05 '22 07:11 aadog

How about a map[string][string] in Go that's always available at window.CustomState or something?

leaanthony avatar Nov 25 '22 03:11 leaanthony